From c3ab053af2c39ab433808d8eca6a637d82743685 Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Wed, 8 Mar 2023 20:45:35 +0300 Subject: [PATCH 01/32] Feature/api-client (#1) * feat(api-client): Create medusa api class and refactor api classes * feat(api-client): Adds base request classes and updates AuthApi --- .idea/uiDesigner.xml | 124 +++++ README.md | 57 +- build.gradle | 2 +- docs/AuthApi.md | 4 +- docs/CustomerApi.md | 14 +- docs/InviteApi.md | 2 +- docs/OrderApi.md | 2 +- docs/PaymentCollectionApi.md | 10 +- docs/ProductCategoryApi.md | 4 +- docs/ProductTypeApi.md | 2 +- pom.xml | 4 +- settings.gradle | 2 +- .../appcent/medusa/store/Configuration.java | 37 -- .../java/mobi/appcent/medusa/store/Main.java | 25 +- .../mobi/appcent/medusa/store/MedusaApi.java | 96 ++++ .../{ApiClient.java => MedusaSdkClient.java} | 83 ++- .../java/mobi/appcent/medusa/store/Pair.java | 3 +- .../appcent/medusa/store/api/AuthApi.java | 498 +----------------- .../appcent/medusa/store/api/BaseApi.java | 14 + .../appcent/medusa/store/api/CartApi.java | 268 +++++----- .../medusa/store/api/CollectionApi.java | 70 ++- .../appcent/medusa/store/api/CustomerApi.java | 212 ++++---- .../appcent/medusa/store/api/GiftCardApi.java | 44 +- .../appcent/medusa/store/api/InviteApi.java | 42 +- .../appcent/medusa/store/api/OrderApi.java | 99 ++-- .../medusa/store/api/OrderEditApi.java | 74 ++- .../store/api/PaymentCollectionApi.java | 130 +++-- .../appcent/medusa/store/api/ProductApi.java | 140 +++-- .../medusa/store/api/ProductCategoryApi.java | 70 ++- .../medusa/store/api/ProductTagApi.java | 64 +-- .../medusa/store/api/ProductTypeApi.java | 63 +-- .../medusa/store/api/ProductVariantApi.java | 89 ++-- .../appcent/medusa/store/api/RegionApi.java | 69 +-- .../appcent/medusa/store/api/ReturnApi.java | 43 +- .../medusa/store/api/ReturnReasonApi.java | 58 +- .../medusa/store/api/ShippingOptionApi.java | 61 +-- .../appcent/medusa/store/api/SwapApi.java | 58 +- .../mobi/appcent/medusa/store/auth/OAuth.java | 3 +- .../medusa/store/common/HeaderConstant.java | 11 + .../medusa/store/common/HttpMethod.java | 11 + .../medusa/store/common/UrlConstant.java | 27 + .../store/model/request/BaseRequest.java | 20 + .../model/request/auth/DeleteAuthRequest.java | 53 ++ .../request/auth/GetAuthEmailRequest.java | 57 ++ .../model/request/auth/GetAuthRequest.java | 51 ++ .../model/request/auth/PostAuthRequest.java | 67 +++ .../store/model/{ => response}/Address.java | 2 +- .../model/{ => response}/AddressFields.java | 2 +- .../{ => response}/AllOfBatchJobResult.java | 2 +- .../AllOfCreateStockLocationInputAddress.java | 2 +- .../AllOfStockLocationDTOAddress.java | 2 +- ...tCustomersCustomerAddressesReqAddress.java | 2 +- .../AllOfUpdateStockLocationInputAddress.java | 2 +- ...OfStorePostCartsCartReqBillingAddress.java | 2 +- ...fStorePostCartsCartReqShippingAddress.java | 2 +- ...ostCustomersCustomerReqBillingAddress.java | 2 +- .../store/model/{ => response}/BatchJob.java | 2 +- .../model/{ => response}/CanceledAt.java | 2 +- .../store/model/{ => response}/Cart.java | 2 +- .../model/{ => response}/ClaimImage.java | 2 +- .../store/model/{ => response}/ClaimItem.java | 2 +- .../model/{ => response}/ClaimOrder.java | 2 +- .../store/model/{ => response}/ClaimTag.java | 2 +- .../store/model/{ => response}/Country.java | 2 +- .../CreateStockLocationInput.java | 2 +- .../store/model/{ => response}/CreatedAt.java | 2 +- .../model/{ => response}/CreatedAt1.java | 2 +- .../model/{ => response}/CreatedAt2.java | 2 +- .../model/{ => response}/CreatedAt3.java | 2 +- .../model/{ => response}/CreatedAt4.java | 2 +- .../model/{ => response}/CreatedAt5.java | 2 +- .../store/model/{ => response}/Currency.java | 2 +- .../{ => response}/CustomShippingOption.java | 2 +- .../store/model/{ => response}/Customer.java | 2 +- .../model/{ => response}/CustomerGroup.java | 2 +- .../store/model/{ => response}/Discount.java | 2 +- .../{ => response}/DiscountCondition.java | 2 +- .../DiscountConditionCustomerGroup.java | 2 +- .../DiscountConditionProduct.java | 2 +- .../DiscountConditionProductCollection.java | 2 +- .../DiscountConditionProductTag.java | 2 +- .../DiscountConditionProductType.java | 2 +- .../model/{ => response}/DiscountRule.java | 2 +- .../model/{ => response}/DraftOrder.java | 2 +- .../store/model/{ => response}/Error.java | 2 +- .../model/{ => response}/Fulfillment.java | 2 +- .../model/{ => response}/FulfillmentItem.java | 2 +- .../{ => response}/FulfillmentProvider.java | 2 +- .../store/model/{ => response}/GiftCard.java | 2 +- .../{ => response}/GiftCardTransaction.java | 2 +- .../medusa/store/model/{ => response}/Id.java | 2 +- .../model/{ => response}/IdempotencyKey.java | 2 +- .../store/model/{ => response}/Image.java | 2 +- .../{ => response}/InlineResponse200.java | 2 +- .../{ => response}/InlineResponse400.java | 2 +- .../{ => response}/InlineResponse422.java | 2 +- .../{ => response}/InventoryItemDTO.java | 2 +- .../{ => response}/InventoryLevelDTO.java | 2 +- .../{ => response}/InventoryQuantity.java | 2 +- .../store/model/{ => response}/Invite.java | 2 +- .../store/model/{ => response}/LineItem.java | 2 +- .../{ => response}/LineItemAdjustment.java | 2 +- .../model/{ => response}/LineItemTaxLine.java | 2 +- .../model/{ => response}/ModelReturn.java | 2 +- .../model/{ => response}/MoneyAmount.java | 2 +- .../model/{ => response}/MultipleErrors.java | 2 +- .../store/model/{ => response}/Note.java | 2 +- .../model/{ => response}/Notification.java | 2 +- .../{ => response}/NotificationProvider.java | 2 +- .../store/model/{ => response}/OAuth.java | 2 +- .../OneOfStoreCompleteCartResData.java | 2 +- .../store/model/{ => response}/Order.java | 2 +- .../store/model/{ => response}/OrderEdit.java | 2 +- .../model/{ => response}/OrderItemChange.java | 2 +- .../store/model/{ => response}/Payment.java | 2 +- .../{ => response}/PaymentCollection.java | 2 +- .../model/{ => response}/PaymentProvider.java | 2 +- .../model/{ => response}/PaymentSession.java | 2 +- .../store/model/{ => response}/PriceList.java | 2 +- .../model/{ => response}/PricedProduct.java | 2 +- .../model/{ => response}/PricedVariant.java | 2 +- .../{ => response}/PricedVariantTaxRates.java | 2 +- .../store/model/{ => response}/Product.java | 2 +- .../model/{ => response}/ProductCategory.java | 2 +- .../{ => response}/ProductCollection.java | 2 +- .../model/{ => response}/ProductOption.java | 2 +- .../{ => response}/ProductOptionValue.java | 2 +- .../model/{ => response}/ProductTag.java | 2 +- .../model/{ => response}/ProductTaxRate.java | 2 +- .../model/{ => response}/ProductType.java | 2 +- .../{ => response}/ProductTypeTaxRate.java | 2 +- .../model/{ => response}/ProductVariant.java | 2 +- .../ProductVariantInventoryItem.java | 2 +- .../{ => response}/PublishableApiKey.java | 2 +- .../PublishableApiKeySalesChannel.java | 2 +- .../store/model/{ => response}/Refund.java | 2 +- .../store/model/{ => response}/Region.java | 2 +- .../{ => response}/ReservationItemDTO.java | 2 +- .../model/{ => response}/ReturnItem.java | 2 +- .../model/{ => response}/ReturnReason.java | 2 +- .../model/{ => response}/SalesChannel.java | 2 +- .../{ => response}/SalesChannelLocation.java | 2 +- .../model/{ => response}/ShippingAddress.java | 2 +- .../model/{ => response}/ShippingMethod.java | 2 +- .../{ => response}/ShippingMethodTaxLine.java | 2 +- .../model/{ => response}/ShippingOption.java | 2 +- .../ShippingOptionRequirement.java | 2 +- .../model/{ => response}/ShippingProfile.java | 2 +- .../model/{ => response}/ShippingTaxRate.java | 2 +- .../store/model/{ => response}/StagedJob.java | 2 +- .../StockLocationAddressDTO.java | 2 +- .../StockLocationAddressInput.java | 2 +- .../{ => response}/StockLocationDTO.java | 2 +- .../store/model/{ => response}/Store.java | 2 +- .../model/{ => response}/StoreAuthRes.java | 2 +- .../model/{ => response}/StoreCartsRes.java | 2 +- .../StoreCollectionsListRes.java | 2 +- .../{ => response}/StoreCollectionsRes.java | 2 +- .../{ => response}/StoreCompleteCartRes.java | 2 +- .../StoreCustomersListOrdersRes.java | 2 +- .../StoreCustomersListPaymentMethodsRes.java | 2 +- ...rsListPaymentMethodsResPaymentMethods.java | 2 +- .../{ => response}/StoreCustomersRes.java | 2 +- .../{ => response}/StoreGetAuthEmailRes.java | 2 +- .../StoreGetProductCategoriesCategoryRes.java | 2 +- .../{ => response}/StoreGiftCardsRes.java | 2 +- .../{ => response}/StoreOrderEditsRes.java | 2 +- .../model/{ => response}/StoreOrdersRes.java | 2 +- .../StorePaymentCollectionSessionsReq.java | 2 +- .../StorePaymentCollectionsRes.java | 2 +- .../StorePaymentCollectionsSessionRes.java | 2 +- .../{ => response}/StorePostAuthReq.java | 2 +- .../{ => response}/StorePostCartReq.java | 2 +- .../{ => response}/StorePostCartReqItems.java | 2 +- .../StorePostCartsCartLineItemsItemReq.java | 2 +- .../StorePostCartsCartLineItemsReq.java | 2 +- .../StorePostCartsCartPaymentSessionReq.java | 2 +- ...ePostCartsCartPaymentSessionUpdateReq.java | 2 +- .../{ => response}/StorePostCartsCartReq.java | 2 +- .../StorePostCartsCartReqDiscounts.java | 2 +- .../StorePostCartsCartReqGiftCards.java | 2 +- .../StorePostCartsCartShippingMethodReq.java | 2 +- ...rePostCustomersCustomerAcceptClaimReq.java | 2 +- ...tCustomersCustomerAddressesAddressReq.java | 2 +- ...torePostCustomersCustomerAddressesReq.java | 2 +- ...orePostCustomersCustomerOrderClaimReq.java | 2 +- ...PostCustomersCustomerPasswordTokenReq.java | 2 +- .../StorePostCustomersCustomerReq.java | 2 +- .../{ => response}/StorePostCustomersReq.java | 2 +- .../StorePostCustomersResetPasswordReq.java | 2 +- .../StorePostOrderEditsOrderEditDecline.java | 2 +- ...tCollectionsBatchSessionsAuthorizeReq.java | 2 +- ...ostPaymentCollectionsBatchSessionsReq.java | 2 +- ...ntCollectionsBatchSessionsReqSessions.java | 2 +- .../{ => response}/StorePostReturnsReq.java | 2 +- .../StorePostReturnsReqItems.java | 2 +- .../StorePostReturnsReqReturnShipping.java | 2 +- .../{ => response}/StorePostSearchRes.java | 2 +- .../{ => response}/StorePostSwapsReq.java | 2 +- .../StorePostSwapsReqAdditionalItems.java | 2 +- .../StorePostSwapsReqReturnItems.java | 2 +- .../StoreProductCategoriesListRes.java | 2 +- .../StoreProductTypesListRes.java | 2 +- .../{ => response}/StoreProductsListRes.java | 2 +- .../{ => response}/StoreProductsRes.java | 2 +- .../{ => response}/StoreRegionsListRes.java | 2 +- .../model/{ => response}/StoreRegionsRes.java | 2 +- .../StoreReturnReasonsListRes.java | 2 +- .../{ => response}/StoreReturnReasonsRes.java | 2 +- .../model/{ => response}/StoreReturnsRes.java | 2 +- .../StoreShippingOptionsListRes.java | 2 +- .../model/{ => response}/StoreSwapsRes.java | 2 +- .../{ => response}/StoreVariantsListRes.java | 2 +- .../{ => response}/StoreVariantsRes.java | 2 +- .../store/model/{ => response}/Swap.java | 2 +- .../store/model/{ => response}/TaxLine.java | 2 +- .../model/{ => response}/TaxProvider.java | 2 +- .../store/model/{ => response}/TaxRate.java | 2 +- .../store/model/{ => response}/Title.java | 2 +- .../model/{ => response}/TrackingLink.java | 2 +- .../UpdateStockLocationInput.java | 2 +- .../store/model/{ => response}/UpdatedAt.java | 2 +- .../model/{ => response}/UpdatedAt1.java | 2 +- .../model/{ => response}/UpdatedAt2.java | 2 +- .../model/{ => response}/UpdatedAt3.java | 2 +- .../model/{ => response}/UpdatedAt4.java | 2 +- .../model/{ => response}/UpdatedAt5.java | 2 +- .../store/model/{ => response}/User.java | 2 +- .../appcent/medusa/store/api/AuthApiTest.java | 15 +- .../appcent/medusa/store/api/CartApiTest.java | 18 +- .../medusa/store/api/CollectionApiTest.java | 8 +- .../medusa/store/api/CustomerApiTest.java | 24 +- .../medusa/store/api/GiftCardApiTest.java | 2 +- .../medusa/store/api/InviteApiTest.java | 2 +- .../medusa/store/api/OrderApiTest.java | 6 +- .../medusa/store/api/OrderEditApiTest.java | 4 +- .../store/api/PaymentCollectionApiTest.java | 10 +- .../medusa/store/api/ProductApiTest.java | 12 +- .../store/api/ProductCategoryApiTest.java | 4 +- .../medusa/store/api/ProductTagApiTest.java | 6 +- .../medusa/store/api/ProductTypeApiTest.java | 6 +- .../store/api/ProductVariantApiTest.java | 8 +- .../medusa/store/api/RegionApiTest.java | 8 +- .../medusa/store/api/ReturnApiTest.java | 4 +- .../medusa/store/api/ReturnReasonApiTest.java | 4 +- .../store/api/ShippingOptionApiTest.java | 2 +- .../appcent/medusa/store/api/SwapApiTest.java | 4 +- 247 files changed, 1683 insertions(+), 1765 deletions(-) create mode 100644 .idea/uiDesigner.xml delete mode 100644 src/main/java/mobi/appcent/medusa/store/Configuration.java create mode 100644 src/main/java/mobi/appcent/medusa/store/MedusaApi.java rename src/main/java/mobi/appcent/medusa/store/{ApiClient.java => MedusaSdkClient.java} (94%) create mode 100644 src/main/java/mobi/appcent/medusa/store/api/BaseApi.java create mode 100644 src/main/java/mobi/appcent/medusa/store/common/HeaderConstant.java create mode 100644 src/main/java/mobi/appcent/medusa/store/common/HttpMethod.java create mode 100644 src/main/java/mobi/appcent/medusa/store/common/UrlConstant.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/BaseRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/auth/DeleteAuthRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/auth/GetAuthEmailRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/auth/GetAuthRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/auth/PostAuthRequest.java rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Address.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/AddressFields.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/AllOfBatchJobResult.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/AllOfCreateStockLocationInputAddress.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/AllOfStockLocationDTOAddress.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/AllOfStorePostCustomersCustomerAddressesReqAddress.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/AllOfUpdateStockLocationInputAddress.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/AnyOfStorePostCartsCartReqBillingAddress.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/AnyOfStorePostCartsCartReqShippingAddress.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/AnyOfStorePostCustomersCustomerReqBillingAddress.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/BatchJob.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/CanceledAt.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Cart.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ClaimImage.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ClaimItem.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ClaimOrder.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ClaimTag.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Country.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/CreateStockLocationInput.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/CreatedAt.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/CreatedAt1.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/CreatedAt2.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/CreatedAt3.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/CreatedAt4.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/CreatedAt5.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Currency.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/CustomShippingOption.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Customer.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/CustomerGroup.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Discount.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/DiscountCondition.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/DiscountConditionCustomerGroup.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/DiscountConditionProduct.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/DiscountConditionProductCollection.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/DiscountConditionProductTag.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/DiscountConditionProductType.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/DiscountRule.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/DraftOrder.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Error.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Fulfillment.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/FulfillmentItem.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/FulfillmentProvider.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/GiftCard.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/GiftCardTransaction.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Id.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/IdempotencyKey.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Image.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/InlineResponse200.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/InlineResponse400.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/InlineResponse422.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/InventoryItemDTO.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/InventoryLevelDTO.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/InventoryQuantity.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Invite.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/LineItem.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/LineItemAdjustment.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/LineItemTaxLine.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ModelReturn.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/MoneyAmount.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/MultipleErrors.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Note.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Notification.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/NotificationProvider.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/OAuth.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/OneOfStoreCompleteCartResData.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Order.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/OrderEdit.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/OrderItemChange.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Payment.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/PaymentCollection.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/PaymentProvider.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/PaymentSession.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/PriceList.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/PricedProduct.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/PricedVariant.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/PricedVariantTaxRates.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Product.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ProductCategory.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ProductCollection.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ProductOption.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ProductOptionValue.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ProductTag.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ProductTaxRate.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ProductType.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ProductTypeTaxRate.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ProductVariant.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ProductVariantInventoryItem.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/PublishableApiKey.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/PublishableApiKeySalesChannel.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Refund.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Region.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ReservationItemDTO.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ReturnItem.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ReturnReason.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/SalesChannel.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/SalesChannelLocation.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ShippingAddress.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ShippingMethod.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ShippingMethodTaxLine.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ShippingOption.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ShippingOptionRequirement.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ShippingProfile.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/ShippingTaxRate.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StagedJob.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StockLocationAddressDTO.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StockLocationAddressInput.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StockLocationDTO.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Store.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreAuthRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreCartsRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreCollectionsListRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreCollectionsRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreCompleteCartRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreCustomersListOrdersRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreCustomersListPaymentMethodsRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreCustomersListPaymentMethodsResPaymentMethods.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreCustomersRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreGetAuthEmailRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreGetProductCategoriesCategoryRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreGiftCardsRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreOrderEditsRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreOrdersRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePaymentCollectionSessionsReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePaymentCollectionsRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePaymentCollectionsSessionRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostAuthReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostCartReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostCartReqItems.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostCartsCartLineItemsItemReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostCartsCartLineItemsReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostCartsCartPaymentSessionReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostCartsCartPaymentSessionUpdateReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostCartsCartReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostCartsCartReqDiscounts.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostCartsCartReqGiftCards.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostCartsCartShippingMethodReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostCustomersCustomerAcceptClaimReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostCustomersCustomerAddressesAddressReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostCustomersCustomerAddressesReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostCustomersCustomerOrderClaimReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostCustomersCustomerPasswordTokenReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostCustomersCustomerReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostCustomersReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostCustomersResetPasswordReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostOrderEditsOrderEditDecline.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostPaymentCollectionsBatchSessionsAuthorizeReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostPaymentCollectionsBatchSessionsReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostPaymentCollectionsBatchSessionsReqSessions.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostReturnsReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostReturnsReqItems.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostReturnsReqReturnShipping.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostSearchRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostSwapsReq.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostSwapsReqAdditionalItems.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StorePostSwapsReqReturnItems.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreProductCategoriesListRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreProductTypesListRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreProductsListRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreProductsRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreRegionsListRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreRegionsRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreReturnReasonsListRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreReturnReasonsRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreReturnsRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreShippingOptionsListRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreSwapsRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreVariantsListRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/StoreVariantsRes.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Swap.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/TaxLine.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/TaxProvider.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/TaxRate.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/Title.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/TrackingLink.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/UpdateStockLocationInput.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/UpdatedAt.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/UpdatedAt1.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/UpdatedAt2.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/UpdatedAt3.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/UpdatedAt4.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/UpdatedAt5.java (99%) rename src/main/java/mobi/appcent/medusa/store/model/{ => response}/User.java (99%) diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index cc2e701..38b2a1e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# medusa-java-client +# medusa-java-sdk Medusa Storefront API - API version: 1.0.0 @@ -39,7 +39,7 @@ Add this dependency to your project's POM: ```xml mobi.appcent - medusa-java-client + medusa-java-sdk 1.0.0 compile @@ -50,7 +50,7 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "mobi.appcent:medusa-java-client:1.0.0" +compile "mobi.appcent:medusa-java-sdk:1.0.0" ``` ### Others @@ -63,7 +63,7 @@ mvn clean package Then manually install the following JARs: -* `target/medusa-java-client-1.0.0.jar` +* `target/medusa-java-sdk-1.0.0.jar` * `target/lib/*.jar` ## Getting Started @@ -71,19 +71,18 @@ Then manually install the following JARs: Please follow the [installation](#installation) instruction and execute the following Java code: ```java -import mobi.appcent.medusa.store.ApiClient; +import mobi.appcent.medusa.store.MedusaSdkClient; import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.Configuration; import mobi.appcent.medusa.store.api.AuthApi; import mobi.appcent.medusa.store.auth.ApiKeyAuth; -import mobi.appcent.medusa.store.model.StoreAuthRes; -import mobi.appcent.medusa.store.model.StoreGetAuthEmailRes; -import mobi.appcent.medusa.store.model.StorePostAuthReq; +import mobi.appcent.medusa.store.model.response.StoreAuthRes; +import mobi.appcent.medusa.store.model.response.StoreGetAuthEmailRes; +import mobi.appcent.medusa.store.model.response.StorePostAuthReq; public class AuthApiExample { public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); + MedusaSdkClient defaultClient = Configuration.getDefaultApiClient(); // Configure API key authorization: cookie_auth ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); @@ -100,18 +99,18 @@ public class AuthApiExample { } } } -import mobi.appcent.medusa.store.*; -import mobi.appcent.medusa.store.auth.*; -import mobi.appcent.medusa.store.model.*; -import mobi.appcent.medusa.store.api.AuthApi; +import mobi.appcent.medusa.store.*; + import mobi.appcent.medusa.store.auth.*; + import mobi.appcent.medusa.store.model.*; + import mobi.appcent.medusa.store.api.AuthApi; -import java.io.File; -import java.util.*; + import java.io.File; + import java.util.*; public class AuthApiExample { public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); + MedusaSdkClient defaultClient = Configuration.getDefaultApiClient(); // Configure API key authorization: cookie_auth ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); @@ -129,13 +128,13 @@ public class AuthApiExample { } } } -import mobi.appcent.medusa.store.*; -import mobi.appcent.medusa.store.auth.*; -import mobi.appcent.medusa.store.model.*; -import mobi.appcent.medusa.store.api.AuthApi; +import mobi.appcent.medusa.store.*; + import mobi.appcent.medusa.store.auth.*; + import mobi.appcent.medusa.store.model.*; + import mobi.appcent.medusa.store.api.AuthApi; -import java.io.File; -import java.util.*; + import java.io.File; + import java.util.*; public class AuthApiExample { @@ -152,13 +151,13 @@ public class AuthApiExample { } } } -import mobi.appcent.medusa.store.*; -import mobi.appcent.medusa.store.auth.*; -import mobi.appcent.medusa.store.model.*; -import mobi.appcent.medusa.store.api.AuthApi; +import mobi.appcent.medusa.store.*; + import mobi.appcent.medusa.store.auth.*; + import mobi.appcent.medusa.store.model.*; + import mobi.appcent.medusa.store.api.AuthApi; -import java.io.File; -import java.util.*; + import java.io.File; + import java.util.*; public class AuthApiExample { diff --git a/build.gradle b/build.gradle index 1758ffb..3cad924 100644 --- a/build.gradle +++ b/build.gradle @@ -83,7 +83,7 @@ if(hasProperty('target') && target == 'android') { install { repositories.mavenInstaller { - pom.artifactId = 'medusa-java-client' + pom.artifactId = 'medusa-java-sdk' } } diff --git a/docs/AuthApi.md b/docs/AuthApi.md index a8a39e6..a4c0557 100644 --- a/docs/AuthApi.md +++ b/docs/AuthApi.md @@ -20,7 +20,7 @@ Destroys a Customer's authenticated session. ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; @@ -70,7 +70,7 @@ Gets the currently logged in Customer. ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; diff --git a/docs/CustomerApi.md b/docs/CustomerApi.md index be19698..b5cb910 100644 --- a/docs/CustomerApi.md +++ b/docs/CustomerApi.md @@ -26,7 +26,7 @@ Removes an Address from the Customer's saved addresses. ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; @@ -81,7 +81,7 @@ Retrieves a Customer - the Customer must be logged in to retrieve their details. ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; @@ -132,7 +132,7 @@ Retrieves a list of a Customer's Orders. ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; @@ -221,7 +221,7 @@ Retrieves a list of a Customer's saved payment methods. Payment methods are ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; @@ -317,7 +317,7 @@ Updates a Customer's saved details. ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; @@ -372,7 +372,7 @@ Adds a Shipping Address to a Customer's saved addresses. ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; @@ -427,7 +427,7 @@ Updates a Customer's saved Shipping Address. ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; diff --git a/docs/InviteApi.md b/docs/InviteApi.md index 432dc9a..b39ff36 100644 --- a/docs/InviteApi.md +++ b/docs/InviteApi.md @@ -17,7 +17,7 @@ Sends an email to emails registered to orders provided with link to transfer ord ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; diff --git a/docs/OrderApi.md b/docs/OrderApi.md index d53a6db..390e982 100644 --- a/docs/OrderApi.md +++ b/docs/OrderApi.md @@ -167,7 +167,7 @@ Verifies the claim order token provided to the customer upon request of order ow ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; diff --git a/docs/PaymentCollectionApi.md b/docs/PaymentCollectionApi.md index d66881a..ce96592 100644 --- a/docs/PaymentCollectionApi.md +++ b/docs/PaymentCollectionApi.md @@ -22,7 +22,7 @@ Get a Payment Collection ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; @@ -128,7 +128,7 @@ Manages Multiple Payment Sessions from Payment Collections. ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; @@ -185,7 +185,7 @@ Manages Payment Sessions from Payment Collections. ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; @@ -242,7 +242,7 @@ Authorizes Payment Sessions of a Payment Collection. ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; @@ -299,7 +299,7 @@ Authorizes a Payment Session of a Payment Collection. ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; diff --git a/docs/ProductCategoryApi.md b/docs/ProductCategoryApi.md index 35f6ef0..bf55c0e 100644 --- a/docs/ProductCategoryApi.md +++ b/docs/ProductCategoryApi.md @@ -18,7 +18,7 @@ Retrieve a list of product categories. ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; @@ -79,7 +79,7 @@ Retrieves a Product Category. ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; diff --git a/docs/ProductTypeApi.md b/docs/ProductTypeApi.md index e5b0fef..5429305 100644 --- a/docs/ProductTypeApi.md +++ b/docs/ProductTypeApi.md @@ -17,7 +17,7 @@ Retrieve a list of Product Types. ### Example ```java // Import classes: -//import mobi.appcent.medusa.store.ApiClient; +//import mobi.appcent.medusa.store.MedusaSdkClient; //import mobi.appcent.medusa.store.ApiException; //import mobi.appcent.medusa.store.Configuration; //import mobi.appcent.medusa.store.auth.*; diff --git a/pom.xml b/pom.xml index 47baa68..3bf3859 100644 --- a/pom.xml +++ b/pom.xml @@ -2,9 +2,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 mobi.appcent - medusa-java-client + medusa-java-sdk 1.0.0 - medusa-java-client + medusa-java-sdk scm:git:git@github.com:swagger-api/swagger-codegen.git diff --git a/settings.gradle b/settings.gradle index e6d3fa3..a0de09d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -rootProject.name = "medusa-java-client" \ No newline at end of file +rootProject.name = "medusa-java-sdk" \ No newline at end of file diff --git a/src/main/java/mobi/appcent/medusa/store/Configuration.java b/src/main/java/mobi/appcent/medusa/store/Configuration.java deleted file mode 100644 index 9efc4e1..0000000 --- a/src/main/java/mobi/appcent/medusa/store/Configuration.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Medusa Storefront API - * API reference for Medusa's Storefront endpoints. All endpoints are prefixed with `/store`. ## Authentication To send requests as an authenticated customer, you must use the Cookie Session ID. ## Expanding Fields In many endpoints you'll find an `expand` query parameter that can be passed to the endpoint. You can use the `expand` query parameter to unpack an entity's relations and return them in the response. Please note that the relations you pass to `expand` replace any relations that are expanded by default in the request. ### Expanding One Relation For example, when you retrieve a product, you can retrieve its collection by passing to the `expand` query parameter the value `collection`: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand=collection\" ``` ### Expanding Multiple Relations You can expand more than one relation by separating the relations in the `expand` query parameter with a comma. For example, to retrieve both the variants and the collection of a product, pass to the `expand` query parameter the value `variants,collection`: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand=variants,collection\" ``` ### Prevent Expanding Relations Some requests expand relations by default. You can prevent that by passing an empty expand value to retrieve an entity without any extra relations. For example: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand\" ``` This would retrieve the product with only its properties, without any relations like `collection`. ## Selecting Fields In many endpoints you'll find a `fields` query parameter that can be passed to the endpoint. You can use the `fields` query parameter to specify which fields in the entity should be returned in the response. Please note that if you pass a `fields` query parameter, only the fields you pass in the value along with the `id` of the entity will be returned in the response. Also, the `fields` query parameter does not affect the expanded relations. You'll have to use the `expand` parameter instead. ### Selecting One Field For example, when you retrieve a list of products, you can retrieve only the titles of the products by passing `title` as a value to the `fields` query parameter: ```bash curl \"http://localhost:9000/store/products?fields=title\" ``` As mentioned above, the expanded relations such as `variants` will still be returned as they're not affected by the `fields` parameter. You can ensure that only the `title` field is returned by passing an empty value to the `expand` query parameter. For example: ```bash curl \"http://localhost:9000/store/products?fields=title&expand\" ``` ### Selecting Multiple Fields You can pass more than one field by seperating the field names in the `fields` query parameter with a comma. For example, to select the `title` and `handle` of a product: ```bash curl \"http://localhost:9000/store/products?fields=title,handle\" ``` ### Retrieve Only the ID You can pass an empty `fields` query parameter to return only the ID of an entity. For example: ```bash curl \"http://localhost:9000/store/products?fields\" ``` You can also pair with an empty `expand` query parameter to ensure that the relations aren't retrieved as well. For example: ```bash curl \"http://localhost:9000/store/products?fields&expand\" ``` ## Query Parameter Types This section covers how to pass some common data types as query parameters. This is useful if you're sending requests to the API endpoints and not using our JS Client. For example, when using cURL or Postman. ### Strings You can pass a string value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?title=Shirt\" ``` If the string has any characters other than letters and numbers, you must encode them. For example, if the string has spaces, you can encode the space with `+` or `%20`: ```bash curl \"http://localhost:9000/store/products?title=Blue%20Shirt\" ``` You can use tools like [this one](https://www.urlencoder.org/) to learn how a value can be encoded. ### Integers You can pass an integer value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?offset=1\" ``` ### Boolean You can pass a boolean value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?is_giftcard=true\" ``` ### Date and DateTime You can pass a date value in the form `=`. The date must be in the format `YYYY-MM-DD`. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17\" ``` You can also pass the time using the format `YYYY-MM-DDTHH:MM:SSZ`. Please note that the `T` and `Z` here are fixed. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17T07:22:30Z\" ``` ### Array Each array value must be passed as a separate query parameter in the form `[]=`. You can also specify the index of each parameter in the brackets `[0]=`. For example: ```bash curl -g \"http://localhost:9000/store/products?sales_channel_id[]=sc_01GPGVB42PZ7N3YQEP2WDM7PC7&sales_channel_id[]=sc_234PGVB42PZ7N3YQEP2WDM7PC7\" ``` Note that the `-g` parameter passed to `curl` disables errors being thrown for using the brackets. Read more [here](https://curl.se/docs/manpage.html#-g). ### Object Object parameters must be passed as separate query parameters in the form `[]=`. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17&created_at[gt]=2022-09-17\" ``` ## Pagination ### Query Parameters In listing endpoints, such as list customers or list products, you can control the pagination using the query parameters `limit` and `offset`. `limit` is used to specify the maximum number of items that can be return in the response. `offset` is used to specify how many items to skip before returning the resulting entities. You can use the `offset` query parameter to change between pages. For example, if the limit is 50, at page 1 the offset should be 0; at page 2 the offset should be 50, and so on. For example, to limit the number of products returned in the List Products endpoint: ```bash curl \"http://localhost:9000/store/products?limit=5\" ``` ### Response Fields In the response of listing endpoints, aside from the entities retrieved, there are three pagination-related fields returned: `count`, `limit`, and `offset`. Similar to the query parameters, `limit` is the maximum number of items that can be returned in the response, and `field` is the number of items that were skipped before the entities in the result. `count` is the total number of available items of this entity. It can be used to determine how many pages are there. For example, if the `count` is 100 and the `limit` is 50, you can divide the `count` by the `limit` to get the number of pages: `100/50 = 2 pages`. - * - * OpenAPI spec version: 1.0.0 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - -package mobi.appcent.medusa.store; - -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2023-02-24T12:45:51.835798768Z[GMT]")public class Configuration { - private static ApiClient defaultApiClient = new ApiClient(); - - /** - * Get the default API client, which would be used when creating API - * instances without providing an API client. - * - * @return Default API client - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; - } - - /** - * Set the default API client, which would be used when creating API - * instances without providing an API client. - * - * @param apiClient API client - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; - } -} diff --git a/src/main/java/mobi/appcent/medusa/store/Main.java b/src/main/java/mobi/appcent/medusa/store/Main.java index 482f3b9..a748333 100644 --- a/src/main/java/mobi/appcent/medusa/store/Main.java +++ b/src/main/java/mobi/appcent/medusa/store/Main.java @@ -1,19 +1,30 @@ package mobi.appcent.medusa.store; -import mobi.appcent.medusa.store.api.AuthApi; -import mobi.appcent.medusa.store.api.CustomerApi; +import mobi.appcent.medusa.store.model.response.StoreAuthRes; +import mobi.appcent.medusa.store.model.response.StorePostAuthReq; /** * Created by erenalpaslan on 25.02.2023 */ public class Main { public static void main(String[] args) { - Configuration.getDefaultApiClient() + MedusaApi medusaApi = new MedusaApi(); + + medusaApi.getDefaultApiClient() .setDebugging(true) - .setBasePath("http://localhost:9000/store") - .setVerifyingSsl(false); + .setVerifyingSsl(false) + .setBasePath("http://localhost:9000/store"); - AuthApi authApi = new AuthApi(); - CustomerApi customerApi = new CustomerApi(); + try { + ApiResponse res = medusaApi + .auth() + .postAuth() + .email("test@gmail.com") + .password("supersecret") + .execute(); + System.out.println(res.getData()); + } catch (ApiException exception) { + System.err.println(exception); + } } } diff --git a/src/main/java/mobi/appcent/medusa/store/MedusaApi.java b/src/main/java/mobi/appcent/medusa/store/MedusaApi.java new file mode 100644 index 0000000..4e3e2c3 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/MedusaApi.java @@ -0,0 +1,96 @@ +package mobi.appcent.medusa.store; + +import mobi.appcent.medusa.store.api.*; +/** + * Created by erenalpaslan on 2.03.2023 + */ +public class MedusaApi { + + private static MedusaSdkClient defaultMedusaSdkClient = new MedusaSdkClient(); + private final AuthApi authApi = AuthApi.getInstance(); + private final CartApi cartApi = CartApi.getInstance(); + private final CollectionApi collectionApi = CollectionApi.getInstance(); + private final CustomerApi customerApi = CustomerApi.getInstance(); + private final GiftCardApi giftCardApi = GiftCardApi.getInstance(); + private final InviteApi inviteApi = InviteApi.getInstance(); + private final OrderApi orderApi = OrderApi.getInstance(); + private final OrderEditApi orderEditApi = OrderEditApi.getInstance(); + private final PaymentCollectionApi paymentCollectionApi = PaymentCollectionApi.getInstance(); + private final ProductApi productApi = ProductApi.getInstance(); + private final ProductCategoryApi productCategoryApi = ProductCategoryApi.getInstance(); + private final ProductTagApi productTagApi = ProductTagApi.getInstance(); + private final ProductTypeApi productTypeApi = ProductTypeApi.getInstance(); + private final ProductVariantApi productVariantApi = ProductVariantApi.getInstance(); + private final RegionApi regionApi = RegionApi.getInstance(); + private final ReturnApi returnApi = ReturnApi.getInstance(); + private final ReturnReasonApi returnReasonApi = ReturnReasonApi.getInstance(); + private final ShippingOptionApi shippingOptionApi = ShippingOptionApi.getInstance(); + private final SwapApi swapApi = SwapApi.getInstance(); + + public MedusaApi() { + initializeSdkClients(); + } + + private void initializeSdkClients() { + authApi.setApiClient(defaultMedusaSdkClient); + cartApi.setApiClient(defaultMedusaSdkClient); + collectionApi.setApiClient(defaultMedusaSdkClient); + customerApi.setApiClient(defaultMedusaSdkClient); + giftCardApi.setApiClient(defaultMedusaSdkClient); + inviteApi.setApiClient(defaultMedusaSdkClient); + orderApi.setApiClient(defaultMedusaSdkClient); + orderEditApi.setApiClient(defaultMedusaSdkClient); + paymentCollectionApi.setApiClient(defaultMedusaSdkClient); + productApi.setApiClient(defaultMedusaSdkClient); + productTypeApi.setApiClient(defaultMedusaSdkClient); + productVariantApi.setApiClient(defaultMedusaSdkClient); + regionApi.setApiClient(defaultMedusaSdkClient); + returnApi.setApiClient(defaultMedusaSdkClient); + returnReasonApi.setApiClient(defaultMedusaSdkClient); + shippingOptionApi.setApiClient(defaultMedusaSdkClient); + swapApi.setApiClient(defaultMedusaSdkClient); + } + + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public MedusaSdkClient getDefaultApiClient() { + return defaultMedusaSdkClient; + } + + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param medusaSdkClient API client + */ + public void setDefaultApiClient(MedusaSdkClient medusaSdkClient) { + defaultMedusaSdkClient = medusaSdkClient; + initializeSdkClients(); + } + + public AuthApi auth() { return authApi; } + public CartApi carts() { return cartApi; } + public CollectionApi collections() { return collectionApi; } + public CustomerApi customers() { return customerApi; } + public GiftCardApi giftCards() { return giftCardApi; } + public InviteApi invites() { return inviteApi; } + public OrderApi orders() { return orderApi; } + public OrderEditApi orderEdit() { return orderEditApi; } + public PaymentCollectionApi paymentCollections() { return paymentCollectionApi; } + public ProductApi products() { return productApi; } + public ProductCategoryApi productCategories() { return productCategoryApi; } + public ProductTagApi productTags() { return productTagApi; } + public ProductTypeApi productTypes() { return productTypeApi; } + public ProductVariantApi productVariants() { return productVariantApi; } + public RegionApi regions() { return regionApi; } + public ReturnApi returns() { return returnApi; } + public ReturnReasonApi returnReasons() { return returnReasonApi; } + public ShippingOptionApi shippingOptions() { return shippingOptionApi; } + public SwapApi swaps() { return swapApi; } + + +} diff --git a/src/main/java/mobi/appcent/medusa/store/ApiClient.java b/src/main/java/mobi/appcent/medusa/store/MedusaSdkClient.java similarity index 94% rename from src/main/java/mobi/appcent/medusa/store/ApiClient.java rename to src/main/java/mobi/appcent/medusa/store/MedusaSdkClient.java index 56b6423..3119e41 100644 --- a/src/main/java/mobi/appcent/medusa/store/ApiClient.java +++ b/src/main/java/mobi/appcent/medusa/store/MedusaSdkClient.java @@ -51,7 +51,7 @@ import mobi.appcent.medusa.store.auth.ApiKeyAuth; import mobi.appcent.medusa.store.auth.OAuth; -public class ApiClient { +public class MedusaSdkClient { private String basePath = "https://api.medusa-commerce.com/store"; private boolean debugging = false; @@ -77,7 +77,7 @@ public class ApiClient { /* * Constructor for ApiClient */ - public ApiClient() { + public MedusaSdkClient() { httpClient = new OkHttpClient(); @@ -110,7 +110,7 @@ public String getBasePath() { * @param basePath Base path of the URL (e.g https://api.medusa-commerce.com/store * @return An instance of OkHttpClient */ - public ApiClient setBasePath(String basePath) { + public MedusaSdkClient setBasePath(String basePath) { this.basePath = basePath; return this; } @@ -130,7 +130,7 @@ public OkHttpClient getHttpClient() { * @param httpClient An instance of OkHttpClient * @return Api Client */ - public ApiClient setHttpClient(OkHttpClient httpClient) { + public MedusaSdkClient setHttpClient(OkHttpClient httpClient) { this.httpClient = httpClient; return this; } @@ -150,7 +150,7 @@ public JSON getJSON() { * @param json JSON object * @return Api client */ - public ApiClient setJSON(JSON json) { + public MedusaSdkClient setJSON(JSON json) { this.json = json; return this; } @@ -172,7 +172,7 @@ public boolean isVerifyingSsl() { * @param verifyingSsl True to verify TLS/SSL connection * @return ApiClient */ - public ApiClient setVerifyingSsl(boolean verifyingSsl) { + public MedusaSdkClient setVerifyingSsl(boolean verifyingSsl) { this.verifyingSsl = verifyingSsl; applySslSettings(); return this; @@ -194,7 +194,7 @@ public InputStream getSslCaCert() { * @param sslCaCert input stream for SSL CA cert * @return ApiClient */ - public ApiClient setSslCaCert(InputStream sslCaCert) { + public MedusaSdkClient setSslCaCert(InputStream sslCaCert) { this.sslCaCert = sslCaCert; applySslSettings(); return this; @@ -211,7 +211,7 @@ public KeyManager[] getKeyManagers() { * @param managers The KeyManagers to use * @return ApiClient */ - public ApiClient setKeyManagers(KeyManager[] managers) { + public MedusaSdkClient setKeyManagers(KeyManager[] managers) { this.keyManagers = managers; applySslSettings(); return this; @@ -221,27 +221,27 @@ public DateFormat getDateFormat() { return dateFormat; } - public ApiClient setDateFormat(DateFormat dateFormat) { + public MedusaSdkClient setDateFormat(DateFormat dateFormat) { this.json.setDateFormat(dateFormat); return this; } - public ApiClient setSqlDateFormat(DateFormat dateFormat) { + public MedusaSdkClient setSqlDateFormat(DateFormat dateFormat) { this.json.setSqlDateFormat(dateFormat); return this; } - public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + public MedusaSdkClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { this.json.setOffsetDateTimeFormat(dateFormat); return this; } - public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + public MedusaSdkClient setLocalDateFormat(DateTimeFormatter dateFormat) { this.json.setLocalDateFormat(dateFormat); return this; } - public ApiClient setLenientOnJson(boolean lenientOnJson) { + public MedusaSdkClient setLenientOnJson(boolean lenientOnJson) { this.json.setLenientOnJson(lenientOnJson); return this; } @@ -346,7 +346,7 @@ public void setAccessToken(String accessToken) { * @param userAgent HTTP request's user agent * @return ApiClient */ - public ApiClient setUserAgent(String userAgent) { + public MedusaSdkClient setUserAgent(String userAgent) { addDefaultHeader("User-Agent", userAgent); return this; } @@ -358,7 +358,7 @@ public ApiClient setUserAgent(String userAgent) { * @param value The header's value * @return ApiClient */ - public ApiClient addDefaultHeader(String key, String value) { + public MedusaSdkClient addDefaultHeader(String key, String value) { defaultHeaderMap.put(key, value); return this; } @@ -378,7 +378,7 @@ public boolean isDebugging() { * @param debugging To enable (true) or disable (false) debugging * @return ApiClient */ - public ApiClient setDebugging(boolean debugging) { + public MedusaSdkClient setDebugging(boolean debugging) { if (debugging != this.debugging) { if (debugging) { loggingInterceptor = new HttpLoggingInterceptor(); @@ -411,7 +411,7 @@ public String getTempFolderPath() { * @param tempFolderPath Temporary folder path * @return ApiClient */ - public ApiClient setTempFolderPath(String tempFolderPath) { + public MedusaSdkClient setTempFolderPath(String tempFolderPath) { this.tempFolderPath = tempFolderPath; return this; } @@ -432,7 +432,7 @@ public int getConnectTimeout() { * @param connectionTimeout connection timeout in milliseconds * @return Api client */ - public ApiClient setConnectTimeout(int connectionTimeout) { + public MedusaSdkClient setConnectTimeout(int connectionTimeout) { httpClient.setConnectTimeout(connectionTimeout, TimeUnit.MILLISECONDS); return this; } @@ -454,7 +454,7 @@ public int getReadTimeout() { * @param readTimeout read timeout in milliseconds * @return Api client */ - public ApiClient setReadTimeout(int readTimeout) { + public MedusaSdkClient setReadTimeout(int readTimeout) { httpClient.setReadTimeout(readTimeout, TimeUnit.MILLISECONDS); return this; } @@ -476,7 +476,7 @@ public int getWriteTimeout() { * @param writeTimeout connection timeout in milliseconds * @return Api client */ - public ApiClient setWriteTimeout(int writeTimeout) { + public MedusaSdkClient setWriteTimeout(int writeTimeout) { httpClient.setWriteTimeout(writeTimeout, TimeUnit.MILLISECONDS); return this; } @@ -942,12 +942,51 @@ public T handleResponse(Response response, Type returnType) throws ApiExcept * @return The HTTP call * @throws ApiException If fail to serialize the request body object */ - public Call buildCall(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public Call buildCall( + String path, + String method, + List queryParams, + List collectionQueryParams, + Object body, + Map headerParams, + Map formParams, + String[] authNames, + ProgressRequestBody.ProgressRequestListener progressRequestListener + ) throws ApiException { Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams, authNames, progressRequestListener); return httpClient.newCall(request); } + /** + * Build HTTP call with the given options. + * + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @return The HTTP call + * @throws ApiException If fail to serialize the request body object + */ + public Call buildCall( + String path, + String method, + List queryParams, + List collectionQueryParams, + Object body, + Map headerParams, + Map formParams, + String[] authNames + ) throws ApiException { + Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams, authNames, null); + + return httpClient.newCall(request); + } + /** * Build an HTTP request with the given options. * @@ -964,6 +1003,8 @@ public Call buildCall(String path, String method, List queryParams, List

queryParams, List collectionQueryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + if (authNames == null) + authNames = new String[] { }; updateParamsForAuth(authNames, queryParams, headerParams); final String url = buildUrl(path, queryParams, collectionQueryParams); diff --git a/src/main/java/mobi/appcent/medusa/store/Pair.java b/src/main/java/mobi/appcent/medusa/store/Pair.java index 8f62470..5111fff 100644 --- a/src/main/java/mobi/appcent/medusa/store/Pair.java +++ b/src/main/java/mobi/appcent/medusa/store/Pair.java @@ -12,7 +12,8 @@ package mobi.appcent.medusa.store; -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2023-02-24T12:45:51.835798768Z[GMT]")public class Pair { +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2023-02-24T12:45:51.835798768Z[GMT]") +public class Pair { private String name = ""; private String value = ""; diff --git a/src/main/java/mobi/appcent/medusa/store/api/AuthApi.java b/src/main/java/mobi/appcent/medusa/store/api/AuthApi.java index 64a7523..23b1dc5 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/AuthApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/AuthApi.java @@ -12,23 +12,22 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.MedusaSdkClient; import com.google.gson.reflect.TypeToken; import java.io.IOException; -import mobi.appcent.medusa.store.model.StoreAuthRes; -import mobi.appcent.medusa.store.model.StoreGetAuthEmailRes; -import mobi.appcent.medusa.store.model.StorePostAuthReq; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.auth.DeleteAuthRequest; +import mobi.appcent.medusa.store.model.request.auth.GetAuthEmailRequest; +import mobi.appcent.medusa.store.model.request.auth.GetAuthRequest; +import mobi.appcent.medusa.store.model.request.auth.PostAuthRequest; +import mobi.appcent.medusa.store.model.response.StoreAuthRes; +import mobi.appcent.medusa.store.model.response.StoreGetAuthEmailRes; +import mobi.appcent.medusa.store.model.response.StorePostAuthReq; import java.lang.reflect.Type; import java.util.ArrayList; @@ -36,83 +35,19 @@ import java.util.List; import java.util.Map; -public class AuthApi { - private ApiClient apiClient; +public class AuthApi extends BaseApi { + private MedusaSdkClient medusaSdkClient; - public AuthApi() { - this(Configuration.getDefaultApiClient()); + public static AuthApi getInstance() { + return new AuthApi(); } - public AuthApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Build call for deleteAuth - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteAuthCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/auth"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteAuthValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = deleteAuthCall(progressListener, progressRequestListener); - return call; - - - - - + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -120,412 +55,37 @@ private com.squareup.okhttp.Call deleteAuthValidateBeforeCall(final ProgressResp * Destroys a Customer's authenticated session. * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public void deleteAuth() throws ApiException { - deleteAuthWithHttpInfo(); - } - - /** - * Customer Log out - * Destroys a Customer's authenticated session. - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteAuthWithHttpInfo() throws ApiException { - com.squareup.okhttp.Call call = deleteAuthValidateBeforeCall(null, null); - return apiClient.execute(call); - } - - /** - * Customer Log out (asynchronously) - * Destroys a Customer's authenticated session. - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteAuthAsync(final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteAuthValidateBeforeCall(progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /** - * Build call for getAuth - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getAuthCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/auth"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getAuthValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = getAuthCall(progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * Get Current Customer - * Gets the currently logged in Customer. - * @return StoreAuthRes - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public StoreAuthRes getAuth() throws ApiException { - ApiResponse resp = getAuthWithHttpInfo(); - return resp.getData(); + public DeleteAuthRequest deleteAuth() throws ApiException { + return new DeleteAuthRequest(medusaSdkClient); } /** * Get Current Customer * Gets the currently logged in Customer. - * @return ApiResponse<StoreAuthRes> + * @return GetAuthRequest * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public ApiResponse getAuthWithHttpInfo() throws ApiException { - com.squareup.okhttp.Call call = getAuthValidateBeforeCall(null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * Get Current Customer (asynchronously) - * Gets the currently logged in Customer. - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getAuthAsync(final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getAuthValidateBeforeCall(progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getAuthEmail - * @param email The email to check if exists. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getAuthEmailCall(String email, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/auth/{email}" - .replaceAll("\\{" + "email" + "\\}", apiClient.escapeString(email.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getAuthEmailValidateBeforeCall(String email, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'email' is set - if (email == null) { - throw new ApiException("Missing the required parameter 'email' when calling getAuthEmail(Async)"); - } - - com.squareup.okhttp.Call call = getAuthEmailCall(email, progressListener, progressRequestListener); - return call; - - - - - + public GetAuthRequest getAuth() throws ApiException { + return new GetAuthRequest(medusaSdkClient); } /** * Check if email exists * Checks if a Customer with the given email has signed up. - * @param email The email to check if exists. (required) - * @return StoreGetAuthEmailRes + * @return GetAuthEmailRequest * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreGetAuthEmailRes getAuthEmail(String email) throws ApiException { - ApiResponse resp = getAuthEmailWithHttpInfo(email); - return resp.getData(); - } - - /** - * Check if email exists - * Checks if a Customer with the given email has signed up. - * @param email The email to check if exists. (required) - * @return ApiResponse<StoreGetAuthEmailRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getAuthEmailWithHttpInfo(String email) throws ApiException { - com.squareup.okhttp.Call call = getAuthEmailValidateBeforeCall(email, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * Check if email exists (asynchronously) - * Checks if a Customer with the given email has signed up. - * @param email The email to check if exists. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getAuthEmailAsync(String email, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getAuthEmailValidateBeforeCall(email, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postAuth - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postAuthCall(StorePostAuthReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/auth"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postAuthValidateBeforeCall(StorePostAuthReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = postAuthCall(body, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * Customer Login - * Logs a Customer in and authorizes them to view their details. Successful authentication will set a session cookie in the Customer's browser. - * @param body (optional) - * @return StoreAuthRes - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public StoreAuthRes postAuth(StorePostAuthReq body) throws ApiException { - ApiResponse resp = postAuthWithHttpInfo(body); - return resp.getData(); + public GetAuthEmailRequest getAuthEmail() throws ApiException { + return new GetAuthEmailRequest(medusaSdkClient); } /** * Customer Login * Logs a Customer in and authorizes them to view their details. Successful authentication will set a session cookie in the Customer's browser. - * @param body (optional) - * @return ApiResponse<StoreAuthRes> + * @return PostAuthRequest * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public ApiResponse postAuthWithHttpInfo(StorePostAuthReq body) throws ApiException { - com.squareup.okhttp.Call call = postAuthValidateBeforeCall(body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * Customer Login (asynchronously) - * Logs a Customer in and authorizes them to view their details. Successful authentication will set a session cookie in the Customer's browser. - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postAuthAsync(StorePostAuthReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postAuthValidateBeforeCall(body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; + public PostAuthRequest postAuth() throws ApiException { + return new PostAuthRequest(medusaSdkClient); } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/BaseApi.java b/src/main/java/mobi/appcent/medusa/store/api/BaseApi.java new file mode 100644 index 0000000..220ed4d --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/api/BaseApi.java @@ -0,0 +1,14 @@ +package mobi.appcent.medusa.store.api; + +import mobi.appcent.medusa.store.MedusaSdkClient; + +/** + * Created by erenalpaslan on 2.03.2023 + */ +abstract class BaseApi { + protected MedusaSdkClient sdkClient; + + protected void setSdkClient(MedusaSdkClient sdkClient) { + this.sdkClient = sdkClient; + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/api/CartApi.java b/src/main/java/mobi/appcent/medusa/store/api/CartApi.java index 2182998..f63de4a 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/CartApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/CartApi.java @@ -12,29 +12,23 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.MedusaSdkClient; import com.google.gson.reflect.TypeToken; import java.io.IOException; -import mobi.appcent.medusa.store.model.StoreCartsRes; -import mobi.appcent.medusa.store.model.StoreCompleteCartRes; -import mobi.appcent.medusa.store.model.StorePostCartReq; -import mobi.appcent.medusa.store.model.StorePostCartsCartLineItemsItemReq; -import mobi.appcent.medusa.store.model.StorePostCartsCartLineItemsReq; -import mobi.appcent.medusa.store.model.StorePostCartsCartPaymentSessionReq; -import mobi.appcent.medusa.store.model.StorePostCartsCartPaymentSessionUpdateReq; -import mobi.appcent.medusa.store.model.StorePostCartsCartReq; -import mobi.appcent.medusa.store.model.StorePostCartsCartShippingMethodReq; +import mobi.appcent.medusa.store.model.response.StoreCartsRes; +import mobi.appcent.medusa.store.model.response.StoreCompleteCartRes; +import mobi.appcent.medusa.store.model.response.StorePostCartReq; +import mobi.appcent.medusa.store.model.response.StorePostCartsCartLineItemsItemReq; +import mobi.appcent.medusa.store.model.response.StorePostCartsCartLineItemsReq; +import mobi.appcent.medusa.store.model.response.StorePostCartsCartPaymentSessionReq; +import mobi.appcent.medusa.store.model.response.StorePostCartsCartPaymentSessionUpdateReq; +import mobi.appcent.medusa.store.model.response.StorePostCartsCartReq; +import mobi.appcent.medusa.store.model.response.StorePostCartsCartShippingMethodReq; import java.lang.reflect.Type; import java.util.ArrayList; @@ -42,23 +36,19 @@ import java.util.List; import java.util.Map; -public class CartApi { - private ApiClient apiClient; +public class CartApi extends BaseApi { + private MedusaSdkClient medusaSdkClient; - public CartApi() { - this(Configuration.getDefaultApiClient()); + public static CartApi getInstance() { + return new CartApi(); } - public CartApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -75,8 +65,8 @@ public com.squareup.okhttp.Call deleteCartsCartDiscountsDiscountCall(String id, // create path and map variables String localVarPath = "/carts/{id}/discounts/{code}" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())) - .replaceAll("\\{" + "code" + "\\}", apiClient.escapeString(code.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())) + .replaceAll("\\{" + "code" + "\\}", medusaSdkClient.escapeString(code.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -88,17 +78,17 @@ public com.squareup.okhttp.Call deleteCartsCartDiscountsDiscountCall(String id, final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -110,7 +100,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -157,7 +147,7 @@ public StoreCartsRes deleteCartsCartDiscountsDiscount(String id, String code) th public ApiResponse deleteCartsCartDiscountsDiscountWithHttpInfo(String id, String code) throws ApiException { com.squareup.okhttp.Call call = deleteCartsCartDiscountsDiscountValidateBeforeCall(id, code, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -192,7 +182,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = deleteCartsCartDiscountsDiscountValidateBeforeCall(id, code, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -209,8 +199,8 @@ public com.squareup.okhttp.Call deleteCartsCartLineItemsItemCall(String id, Stri // create path and map variables String localVarPath = "/carts/{id}/line-items/{line_id}" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())) - .replaceAll("\\{" + "line_id" + "\\}", apiClient.escapeString(lineId.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())) + .replaceAll("\\{" + "line_id" + "\\}", medusaSdkClient.escapeString(lineId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -222,17 +212,17 @@ public com.squareup.okhttp.Call deleteCartsCartLineItemsItemCall(String id, Stri final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -244,7 +234,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -291,7 +281,7 @@ public StoreCartsRes deleteCartsCartLineItemsItem(String id, String lineId) thro public ApiResponse deleteCartsCartLineItemsItemWithHttpInfo(String id, String lineId) throws ApiException { com.squareup.okhttp.Call call = deleteCartsCartLineItemsItemValidateBeforeCall(id, lineId, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -326,7 +316,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = deleteCartsCartLineItemsItemValidateBeforeCall(id, lineId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -343,8 +333,8 @@ public com.squareup.okhttp.Call deleteCartsCartPaymentSessionsSessionCall(String // create path and map variables String localVarPath = "/carts/{id}/payment-sessions/{provider_id}" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())) - .replaceAll("\\{" + "provider_id" + "\\}", apiClient.escapeString(providerId.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())) + .replaceAll("\\{" + "provider_id" + "\\}", medusaSdkClient.escapeString(providerId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -356,17 +346,17 @@ public com.squareup.okhttp.Call deleteCartsCartPaymentSessionsSessionCall(String final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -378,7 +368,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -425,7 +415,7 @@ public StoreCartsRes deleteCartsCartPaymentSessionsSession(String id, String pro public ApiResponse deleteCartsCartPaymentSessionsSessionWithHttpInfo(String id, String providerId) throws ApiException { com.squareup.okhttp.Call call = deleteCartsCartPaymentSessionsSessionValidateBeforeCall(id, providerId, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -460,7 +450,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = deleteCartsCartPaymentSessionsSessionValidateBeforeCall(id, providerId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -476,7 +466,7 @@ public com.squareup.okhttp.Call getCartsCartCall(String id, final ProgressRespon // create path and map variables String localVarPath = "/carts/{id}" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -488,17 +478,17 @@ public com.squareup.okhttp.Call getCartsCartCall(String id, final ProgressRespon final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -510,7 +500,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -551,7 +541,7 @@ public StoreCartsRes getCartsCart(String id) throws ApiException { public ApiResponse getCartsCartWithHttpInfo(String id) throws ApiException { com.squareup.okhttp.Call call = getCartsCartValidateBeforeCall(id, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -585,7 +575,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getCartsCartValidateBeforeCall(id, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -612,17 +602,17 @@ public com.squareup.okhttp.Call postCartCall(StorePostCartReq body, final Progre final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -634,7 +624,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -671,7 +661,7 @@ public StoreCartsRes postCart(StorePostCartReq body) throws ApiException { public ApiResponse postCartWithHttpInfo(StorePostCartReq body) throws ApiException { com.squareup.okhttp.Call call = postCartValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -705,7 +695,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postCartValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -722,7 +712,7 @@ public com.squareup.okhttp.Call postCartsCartCall(String id, StorePostCartsCartR // create path and map variables String localVarPath = "/carts/{id}" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -734,17 +724,17 @@ public com.squareup.okhttp.Call postCartsCartCall(String id, StorePostCartsCartR final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -756,7 +746,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -799,7 +789,7 @@ public StoreCartsRes postCartsCart(String id, StorePostCartsCartReq body) throws public ApiResponse postCartsCartWithHttpInfo(String id, StorePostCartsCartReq body) throws ApiException { com.squareup.okhttp.Call call = postCartsCartValidateBeforeCall(id, body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -834,7 +824,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postCartsCartValidateBeforeCall(id, body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -850,7 +840,7 @@ public com.squareup.okhttp.Call postCartsCartCompleteCall(String id, final Progr // create path and map variables String localVarPath = "/carts/{id}/complete" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -862,17 +852,17 @@ public com.squareup.okhttp.Call postCartsCartCompleteCall(String id, final Progr final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -884,7 +874,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -925,7 +915,7 @@ public StoreCompleteCartRes postCartsCartComplete(String id) throws ApiException public ApiResponse postCartsCartCompleteWithHttpInfo(String id) throws ApiException { com.squareup.okhttp.Call call = postCartsCartCompleteValidateBeforeCall(id, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -959,7 +949,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postCartsCartCompleteValidateBeforeCall(id, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -976,7 +966,7 @@ public com.squareup.okhttp.Call postCartsCartLineItemsCall(String id, StorePostC // create path and map variables String localVarPath = "/carts/{id}/line-items" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -988,17 +978,17 @@ public com.squareup.okhttp.Call postCartsCartLineItemsCall(String id, StorePostC final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -1010,7 +1000,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -1053,7 +1043,7 @@ public StoreCartsRes postCartsCartLineItems(String id, StorePostCartsCartLineIte public ApiResponse postCartsCartLineItemsWithHttpInfo(String id, StorePostCartsCartLineItemsReq body) throws ApiException { com.squareup.okhttp.Call call = postCartsCartLineItemsValidateBeforeCall(id, body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -1088,7 +1078,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postCartsCartLineItemsValidateBeforeCall(id, body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -1106,8 +1096,8 @@ public com.squareup.okhttp.Call postCartsCartLineItemsItemCall(String id, String // create path and map variables String localVarPath = "/carts/{id}/line-items/{line_id}" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())) - .replaceAll("\\{" + "line_id" + "\\}", apiClient.escapeString(lineId.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())) + .replaceAll("\\{" + "line_id" + "\\}", medusaSdkClient.escapeString(lineId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1119,17 +1109,17 @@ public com.squareup.okhttp.Call postCartsCartLineItemsItemCall(String id, String final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -1141,7 +1131,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -1190,7 +1180,7 @@ public StoreCartsRes postCartsCartLineItemsItem(String id, String lineId, StoreP public ApiResponse postCartsCartLineItemsItemWithHttpInfo(String id, String lineId, StorePostCartsCartLineItemsItemReq body) throws ApiException { com.squareup.okhttp.Call call = postCartsCartLineItemsItemValidateBeforeCall(id, lineId, body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -1226,7 +1216,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postCartsCartLineItemsItemValidateBeforeCall(id, lineId, body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -1243,7 +1233,7 @@ public com.squareup.okhttp.Call postCartsCartPaymentSessionCall(String id, Store // create path and map variables String localVarPath = "/carts/{id}/payment-session" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1255,17 +1245,17 @@ public com.squareup.okhttp.Call postCartsCartPaymentSessionCall(String id, Store final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -1277,7 +1267,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -1320,7 +1310,7 @@ public StoreCartsRes postCartsCartPaymentSession(String id, StorePostCartsCartPa public ApiResponse postCartsCartPaymentSessionWithHttpInfo(String id, StorePostCartsCartPaymentSessionReq body) throws ApiException { com.squareup.okhttp.Call call = postCartsCartPaymentSessionValidateBeforeCall(id, body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -1355,7 +1345,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postCartsCartPaymentSessionValidateBeforeCall(id, body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -1373,8 +1363,8 @@ public com.squareup.okhttp.Call postCartsCartPaymentSessionUpdateCall(String id, // create path and map variables String localVarPath = "/carts/{id}/payment-sessions/{provider_id}" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())) - .replaceAll("\\{" + "provider_id" + "\\}", apiClient.escapeString(providerId.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())) + .replaceAll("\\{" + "provider_id" + "\\}", medusaSdkClient.escapeString(providerId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1386,17 +1376,17 @@ public com.squareup.okhttp.Call postCartsCartPaymentSessionUpdateCall(String id, final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -1408,7 +1398,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -1457,7 +1447,7 @@ public StoreCartsRes postCartsCartPaymentSessionUpdate(String id, String provide public ApiResponse postCartsCartPaymentSessionUpdateWithHttpInfo(String id, String providerId, StorePostCartsCartPaymentSessionUpdateReq body) throws ApiException { com.squareup.okhttp.Call call = postCartsCartPaymentSessionUpdateValidateBeforeCall(id, providerId, body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -1493,7 +1483,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postCartsCartPaymentSessionUpdateValidateBeforeCall(id, providerId, body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -1509,7 +1499,7 @@ public com.squareup.okhttp.Call postCartsCartPaymentSessionsCall(String id, fina // create path and map variables String localVarPath = "/carts/{id}/payment-sessions" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1521,17 +1511,17 @@ public com.squareup.okhttp.Call postCartsCartPaymentSessionsCall(String id, fina final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -1543,7 +1533,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -1584,7 +1574,7 @@ public StoreCartsRes postCartsCartPaymentSessions(String id) throws ApiException public ApiResponse postCartsCartPaymentSessionsWithHttpInfo(String id) throws ApiException { com.squareup.okhttp.Call call = postCartsCartPaymentSessionsValidateBeforeCall(id, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -1618,7 +1608,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postCartsCartPaymentSessionsValidateBeforeCall(id, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -1635,8 +1625,8 @@ public com.squareup.okhttp.Call postCartsCartPaymentSessionsSessionCall(String i // create path and map variables String localVarPath = "/carts/{id}/payment-sessions/{provider_id}/refresh" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())) - .replaceAll("\\{" + "provider_id" + "\\}", apiClient.escapeString(providerId.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())) + .replaceAll("\\{" + "provider_id" + "\\}", medusaSdkClient.escapeString(providerId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1648,17 +1638,17 @@ public com.squareup.okhttp.Call postCartsCartPaymentSessionsSessionCall(String i final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -1670,7 +1660,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -1717,7 +1707,7 @@ public StoreCartsRes postCartsCartPaymentSessionsSession(String id, String provi public ApiResponse postCartsCartPaymentSessionsSessionWithHttpInfo(String id, String providerId) throws ApiException { com.squareup.okhttp.Call call = postCartsCartPaymentSessionsSessionValidateBeforeCall(id, providerId, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -1752,7 +1742,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postCartsCartPaymentSessionsSessionValidateBeforeCall(id, providerId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -1769,7 +1759,7 @@ public com.squareup.okhttp.Call postCartsCartShippingMethodCall(String id, Store // create path and map variables String localVarPath = "/carts/{id}/shipping-methods" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1781,17 +1771,17 @@ public com.squareup.okhttp.Call postCartsCartShippingMethodCall(String id, Store final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -1803,7 +1793,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -1846,7 +1836,7 @@ public StoreCartsRes postCartsCartShippingMethod(String id, StorePostCartsCartSh public ApiResponse postCartsCartShippingMethodWithHttpInfo(String id, StorePostCartsCartShippingMethodReq body) throws ApiException { com.squareup.okhttp.Call call = postCartsCartShippingMethodValidateBeforeCall(id, body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -1881,7 +1871,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postCartsCartShippingMethodValidateBeforeCall(id, body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -1897,7 +1887,7 @@ public com.squareup.okhttp.Call postCartsCartTaxesCall(String id, final Progress // create path and map variables String localVarPath = "/carts/{id}/taxes" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1909,17 +1899,17 @@ public com.squareup.okhttp.Call postCartsCartTaxesCall(String id, final Progress final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -1931,7 +1921,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -1972,7 +1962,7 @@ public StoreCartsRes postCartsCartTaxes(String id) throws ApiException { public ApiResponse postCartsCartTaxesWithHttpInfo(String id) throws ApiException { com.squareup.okhttp.Call call = postCartsCartTaxesValidateBeforeCall(id, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -2006,7 +1996,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postCartsCartTaxesValidateBeforeCall(id, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/CollectionApi.java b/src/main/java/mobi/appcent/medusa/store/api/CollectionApi.java index 7c77137..98b11ff 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/CollectionApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/CollectionApi.java @@ -12,24 +12,18 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.MedusaSdkClient; import com.google.gson.reflect.TypeToken; import java.io.IOException; -import mobi.appcent.medusa.store.model.CreatedAt; -import mobi.appcent.medusa.store.model.StoreCollectionsListRes; -import mobi.appcent.medusa.store.model.StoreCollectionsRes; -import mobi.appcent.medusa.store.model.UpdatedAt; +import mobi.appcent.medusa.store.model.response.CreatedAt; +import mobi.appcent.medusa.store.model.response.StoreCollectionsListRes; +import mobi.appcent.medusa.store.model.response.StoreCollectionsRes; +import mobi.appcent.medusa.store.model.response.UpdatedAt; import java.lang.reflect.Type; import java.util.ArrayList; @@ -38,22 +32,18 @@ import java.util.Map; public class CollectionApi { - private ApiClient apiClient; + private MedusaSdkClient medusaSdkClient; - public CollectionApi() { - this(Configuration.getDefaultApiClient()); + public static CollectionApi getInstance() { + return new CollectionApi(); } - public CollectionApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -76,13 +66,13 @@ public com.squareup.okhttp.Call getCollectionsCall(Integer offset, Integer limit List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (offset != null) - localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("offset", offset)); if (limit != null) - localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("limit", limit)); if (createdAt != null) - localVarQueryParams.addAll(apiClient.parameterToPair("created_at", createdAt)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("created_at", createdAt)); if (updatedAt != null) - localVarQueryParams.addAll(apiClient.parameterToPair("updated_at", updatedAt)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("updated_at", updatedAt)); Map localVarHeaderParams = new HashMap(); @@ -91,17 +81,17 @@ public com.squareup.okhttp.Call getCollectionsCall(Integer offset, Integer limit final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -113,7 +103,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -156,7 +146,7 @@ public StoreCollectionsListRes getCollections(Integer offset, Integer limit, Cre public ApiResponse getCollectionsWithHttpInfo(Integer offset, Integer limit, CreatedAt createdAt, UpdatedAt updatedAt) throws ApiException { com.squareup.okhttp.Call call = getCollectionsValidateBeforeCall(offset, limit, createdAt, updatedAt, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -193,7 +183,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getCollectionsValidateBeforeCall(offset, limit, createdAt, updatedAt, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -209,7 +199,7 @@ public com.squareup.okhttp.Call getCollectionsCollectionCall(String id, final Pr // create path and map variables String localVarPath = "/collections/{id}" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -221,17 +211,17 @@ public com.squareup.okhttp.Call getCollectionsCollectionCall(String id, final Pr final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -243,7 +233,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -284,7 +274,7 @@ public StoreCollectionsRes getCollectionsCollection(String id) throws ApiExcepti public ApiResponse getCollectionsCollectionWithHttpInfo(String id) throws ApiException { com.squareup.okhttp.Call call = getCollectionsCollectionValidateBeforeCall(id, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -318,7 +308,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getCollectionsCollectionValidateBeforeCall(id, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/CustomerApi.java b/src/main/java/mobi/appcent/medusa/store/api/CustomerApi.java index ebf1f20..7c5004c 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/CustomerApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/CustomerApi.java @@ -12,32 +12,26 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.MedusaSdkClient; import com.google.gson.reflect.TypeToken; import java.io.IOException; -import mobi.appcent.medusa.store.model.CanceledAt; -import mobi.appcent.medusa.store.model.CreatedAt1; -import mobi.appcent.medusa.store.model.StoreCustomersListOrdersRes; -import mobi.appcent.medusa.store.model.StoreCustomersListPaymentMethodsRes; -import mobi.appcent.medusa.store.model.StoreCustomersRes; -import mobi.appcent.medusa.store.model.StorePostCustomersCustomerAddressesAddressReq; -import mobi.appcent.medusa.store.model.StorePostCustomersCustomerAddressesReq; -import mobi.appcent.medusa.store.model.StorePostCustomersCustomerPasswordTokenReq; -import mobi.appcent.medusa.store.model.StorePostCustomersCustomerReq; -import mobi.appcent.medusa.store.model.StorePostCustomersReq; -import mobi.appcent.medusa.store.model.StorePostCustomersResetPasswordReq; -import mobi.appcent.medusa.store.model.UpdatedAt1; +import mobi.appcent.medusa.store.model.response.CanceledAt; +import mobi.appcent.medusa.store.model.response.CreatedAt1; +import mobi.appcent.medusa.store.model.response.StoreCustomersListOrdersRes; +import mobi.appcent.medusa.store.model.response.StoreCustomersListPaymentMethodsRes; +import mobi.appcent.medusa.store.model.response.StoreCustomersRes; +import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerAddressesAddressReq; +import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerAddressesReq; +import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerPasswordTokenReq; +import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerReq; +import mobi.appcent.medusa.store.model.response.StorePostCustomersReq; +import mobi.appcent.medusa.store.model.response.StorePostCustomersResetPasswordReq; +import mobi.appcent.medusa.store.model.response.UpdatedAt1; import java.lang.reflect.Type; import java.util.ArrayList; @@ -46,22 +40,18 @@ import java.util.Map; public class CustomerApi { - private ApiClient apiClient; + private MedusaSdkClient medusaSdkClient; - public CustomerApi() { - this(Configuration.getDefaultApiClient()); + public static CustomerApi getInstance() { + return new CustomerApi(); } - public CustomerApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -77,7 +67,7 @@ public com.squareup.okhttp.Call deleteCustomersCustomerAddressesAddressCall(Stri // create path and map variables String localVarPath = "/customers/me/addresses/{address_id}" - .replaceAll("\\{" + "address_id" + "\\}", apiClient.escapeString(addressId.toString())); + .replaceAll("\\{" + "address_id" + "\\}", medusaSdkClient.escapeString(addressId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -89,17 +79,17 @@ public com.squareup.okhttp.Call deleteCustomersCustomerAddressesAddressCall(Stri final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -111,7 +101,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -152,7 +142,7 @@ public StoreCustomersRes deleteCustomersCustomerAddressesAddress(String addressI public ApiResponse deleteCustomersCustomerAddressesAddressWithHttpInfo(String addressId) throws ApiException { com.squareup.okhttp.Call call = deleteCustomersCustomerAddressesAddressValidateBeforeCall(addressId, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -186,7 +176,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = deleteCustomersCustomerAddressesAddressValidateBeforeCall(addressId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -212,17 +202,17 @@ public com.squareup.okhttp.Call getCustomersCustomerCall(final ProgressResponseB final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -234,7 +224,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -269,7 +259,7 @@ public StoreCustomersRes getCustomersCustomer() throws ApiException { public ApiResponse getCustomersCustomerWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getCustomersCustomerValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -302,7 +292,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getCustomersCustomerValidateBeforeCall(progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -339,41 +329,41 @@ public com.squareup.okhttp.Call getCustomersCustomerOrdersCall(String q, String List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (q != null) - localVarQueryParams.addAll(apiClient.parameterToPair("q", q)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("q", q)); if (id != null) - localVarQueryParams.addAll(apiClient.parameterToPair("id", id)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("id", id)); if (status != null) - localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); + localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "status", status)); if (fulfillmentStatus != null) - localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "fulfillment_status", fulfillmentStatus)); + localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "fulfillment_status", fulfillmentStatus)); if (paymentStatus != null) - localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "payment_status", paymentStatus)); + localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "payment_status", paymentStatus)); if (displayId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("display_id", displayId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("display_id", displayId)); if (cartId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("cart_id", cartId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("cart_id", cartId)); if (email != null) - localVarQueryParams.addAll(apiClient.parameterToPair("email", email)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("email", email)); if (regionId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("region_id", regionId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("region_id", regionId)); if (currencyCode != null) - localVarQueryParams.addAll(apiClient.parameterToPair("currency_code", currencyCode)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("currency_code", currencyCode)); if (taxRate != null) - localVarQueryParams.addAll(apiClient.parameterToPair("tax_rate", taxRate)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("tax_rate", taxRate)); if (createdAt != null) - localVarQueryParams.addAll(apiClient.parameterToPair("created_at", createdAt)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("created_at", createdAt)); if (updatedAt != null) - localVarQueryParams.addAll(apiClient.parameterToPair("updated_at", updatedAt)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("updated_at", updatedAt)); if (canceledAt != null) - localVarQueryParams.addAll(apiClient.parameterToPair("canceled_at", canceledAt)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("canceled_at", canceledAt)); if (limit != null) - localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("limit", limit)); if (offset != null) - localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("offset", offset)); if (fields != null) - localVarQueryParams.addAll(apiClient.parameterToPair("fields", fields)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("fields", fields)); if (expand != null) - localVarQueryParams.addAll(apiClient.parameterToPair("expand", expand)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("expand", expand)); Map localVarHeaderParams = new HashMap(); @@ -382,17 +372,17 @@ public com.squareup.okhttp.Call getCustomersCustomerOrdersCall(String q, String final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -404,7 +394,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -475,7 +465,7 @@ public StoreCustomersListOrdersRes getCustomersCustomerOrders(String q, String i public ApiResponse getCustomersCustomerOrdersWithHttpInfo(String q, String id, List status, List fulfillmentStatus, List paymentStatus, String displayId, String cartId, String email, String regionId, String currencyCode, String taxRate, CreatedAt1 createdAt, UpdatedAt1 updatedAt, CanceledAt canceledAt, Integer limit, Integer offset, String fields, String expand) throws ApiException { com.squareup.okhttp.Call call = getCustomersCustomerOrdersValidateBeforeCall(q, id, status, fulfillmentStatus, paymentStatus, displayId, cartId, email, regionId, currencyCode, taxRate, createdAt, updatedAt, canceledAt, limit, offset, fields, expand, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -526,7 +516,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getCustomersCustomerOrdersValidateBeforeCall(q, id, status, fulfillmentStatus, paymentStatus, displayId, cartId, email, regionId, currencyCode, taxRate, createdAt, updatedAt, canceledAt, limit, offset, fields, expand, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -552,17 +542,17 @@ public com.squareup.okhttp.Call getCustomersCustomerPaymentMethodsCall(final Pro final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -574,7 +564,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -609,7 +599,7 @@ public StoreCustomersListPaymentMethodsRes getCustomersCustomerPaymentMethods() public ApiResponse getCustomersCustomerPaymentMethodsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getCustomersCustomerPaymentMethodsValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -642,7 +632,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getCustomersCustomerPaymentMethodsValidateBeforeCall(progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -669,17 +659,17 @@ public com.squareup.okhttp.Call postCustomersCall(StorePostCustomersReq body, fi final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -691,7 +681,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -728,7 +718,7 @@ public StoreCustomersRes postCustomers(StorePostCustomersReq body) throws ApiExc public ApiResponse postCustomersWithHttpInfo(StorePostCustomersReq body) throws ApiException { com.squareup.okhttp.Call call = postCustomersValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -762,7 +752,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postCustomersValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -789,17 +779,17 @@ public com.squareup.okhttp.Call postCustomersCustomerCall(StorePostCustomersCust final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -811,7 +801,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -848,7 +838,7 @@ public StoreCustomersRes postCustomersCustomer(StorePostCustomersCustomerReq bod public ApiResponse postCustomersCustomerWithHttpInfo(StorePostCustomersCustomerReq body) throws ApiException { com.squareup.okhttp.Call call = postCustomersCustomerValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -882,7 +872,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postCustomersCustomerValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -909,17 +899,17 @@ public com.squareup.okhttp.Call postCustomersCustomerAddressesCall(StorePostCust final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -931,7 +921,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -968,7 +958,7 @@ public StoreCustomersRes postCustomersCustomerAddresses(StorePostCustomersCustom public ApiResponse postCustomersCustomerAddressesWithHttpInfo(StorePostCustomersCustomerAddressesReq body) throws ApiException { com.squareup.okhttp.Call call = postCustomersCustomerAddressesValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -1002,7 +992,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postCustomersCustomerAddressesValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -1019,7 +1009,7 @@ public com.squareup.okhttp.Call postCustomersCustomerAddressesAddressCall(String // create path and map variables String localVarPath = "/customers/me/addresses/{address_id}" - .replaceAll("\\{" + "address_id" + "\\}", apiClient.escapeString(addressId.toString())); + .replaceAll("\\{" + "address_id" + "\\}", medusaSdkClient.escapeString(addressId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1031,17 +1021,17 @@ public com.squareup.okhttp.Call postCustomersCustomerAddressesAddressCall(String final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -1053,7 +1043,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -1096,7 +1086,7 @@ public StoreCustomersRes postCustomersCustomerAddressesAddress(String addressId, public ApiResponse postCustomersCustomerAddressesAddressWithHttpInfo(String addressId, StorePostCustomersCustomerAddressesAddressReq body) throws ApiException { com.squareup.okhttp.Call call = postCustomersCustomerAddressesAddressValidateBeforeCall(addressId, body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -1131,7 +1121,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postCustomersCustomerAddressesAddressValidateBeforeCall(addressId, body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -1158,17 +1148,17 @@ public com.squareup.okhttp.Call postCustomersCustomerPasswordTokenCall(StorePost final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -1180,7 +1170,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -1214,7 +1204,7 @@ public void postCustomersCustomerPasswordToken(StorePostCustomersCustomerPasswor */ public ApiResponse postCustomersCustomerPasswordTokenWithHttpInfo(StorePostCustomersCustomerPasswordTokenReq body) throws ApiException { com.squareup.okhttp.Call call = postCustomersCustomerPasswordTokenValidateBeforeCall(body, null, null); - return apiClient.execute(call); + return medusaSdkClient.execute(call); } /** @@ -1247,7 +1237,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don } com.squareup.okhttp.Call call = postCustomersCustomerPasswordTokenValidateBeforeCall(body, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); + medusaSdkClient.executeAsync(call, callback); return call; } /** @@ -1274,17 +1264,17 @@ public com.squareup.okhttp.Call postCustomersResetPasswordCall(StorePostCustomer final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -1296,7 +1286,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -1333,7 +1323,7 @@ public StoreCustomersRes postCustomersResetPassword(StorePostCustomersResetPassw public ApiResponse postCustomersResetPasswordWithHttpInfo(StorePostCustomersResetPasswordReq body) throws ApiException { com.squareup.okhttp.Call call = postCustomersResetPasswordValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -1367,7 +1357,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postCustomersResetPasswordValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/GiftCardApi.java b/src/main/java/mobi/appcent/medusa/store/api/GiftCardApi.java index 3f4c37d..e402fa8 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/GiftCardApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/GiftCardApi.java @@ -12,21 +12,15 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.MedusaSdkClient; import com.google.gson.reflect.TypeToken; import java.io.IOException; -import mobi.appcent.medusa.store.model.StoreGiftCardsRes; +import mobi.appcent.medusa.store.model.response.StoreGiftCardsRes; import java.lang.reflect.Type; import java.util.ArrayList; @@ -35,22 +29,18 @@ import java.util.Map; public class GiftCardApi { - private ApiClient apiClient; + private MedusaSdkClient medusaSdkClient; - public GiftCardApi() { - this(Configuration.getDefaultApiClient()); + public static GiftCardApi getInstance() { + return new GiftCardApi(); } - public GiftCardApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -66,7 +56,7 @@ public com.squareup.okhttp.Call getGiftCardsCodeCall(String code, final Progress // create path and map variables String localVarPath = "/gift-cards/{code}" - .replaceAll("\\{" + "code" + "\\}", apiClient.escapeString(code.toString())); + .replaceAll("\\{" + "code" + "\\}", medusaSdkClient.escapeString(code.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -78,17 +68,17 @@ public com.squareup.okhttp.Call getGiftCardsCodeCall(String code, final Progress final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -100,7 +90,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -141,7 +131,7 @@ public StoreGiftCardsRes getGiftCardsCode(String code) throws ApiException { public ApiResponse getGiftCardsCodeWithHttpInfo(String code) throws ApiException { com.squareup.okhttp.Call call = getGiftCardsCodeValidateBeforeCall(code, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -175,7 +165,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getGiftCardsCodeValidateBeforeCall(code, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/InviteApi.java b/src/main/java/mobi/appcent/medusa/store/api/InviteApi.java index fe0568d..c04e33c 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/InviteApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/InviteApi.java @@ -12,19 +12,13 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.MedusaSdkClient; import java.io.IOException; -import mobi.appcent.medusa.store.model.StorePostCustomersCustomerOrderClaimReq; +import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerOrderClaimReq; import java.util.ArrayList; import java.util.HashMap; @@ -32,22 +26,18 @@ import java.util.Map; public class InviteApi { - private ApiClient apiClient; + private MedusaSdkClient medusaSdkClient; - public InviteApi() { - this(Configuration.getDefaultApiClient()); + public static InviteApi getInstance() { + return new InviteApi(); } - public InviteApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -74,17 +64,17 @@ public com.squareup.okhttp.Call postOrdersCustomerOrderClaimCall(StorePostCustom final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -96,7 +86,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -130,7 +120,7 @@ public void postOrdersCustomerOrderClaim(StorePostCustomersCustomerOrderClaimReq */ public ApiResponse postOrdersCustomerOrderClaimWithHttpInfo(StorePostCustomersCustomerOrderClaimReq body) throws ApiException { com.squareup.okhttp.Call call = postOrdersCustomerOrderClaimValidateBeforeCall(body, null, null); - return apiClient.execute(call); + return medusaSdkClient.execute(call); } /** @@ -163,7 +153,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don } com.squareup.okhttp.Call call = postOrdersCustomerOrderClaimValidateBeforeCall(body, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); + medusaSdkClient.executeAsync(call, callback); return call; } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/OrderApi.java b/src/main/java/mobi/appcent/medusa/store/api/OrderApi.java index 63ad80e..ef8889c 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/OrderApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/OrderApi.java @@ -12,14 +12,7 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; import com.google.gson.reflect.TypeToken; @@ -28,9 +21,9 @@ import java.math.BigDecimal; -import mobi.appcent.medusa.store.model.ShippingAddress; -import mobi.appcent.medusa.store.model.StoreOrdersRes; -import mobi.appcent.medusa.store.model.StorePostCustomersCustomerAcceptClaimReq; +import mobi.appcent.medusa.store.model.response.ShippingAddress; +import mobi.appcent.medusa.store.model.response.StoreOrdersRes; +import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerAcceptClaimReq; import java.lang.reflect.Type; import java.util.ArrayList; @@ -39,22 +32,18 @@ import java.util.Map; public class OrderApi { - private ApiClient apiClient; + private MedusaSdkClient medusaSdkClient; - public OrderApi() { - this(Configuration.getDefaultApiClient()); + public static OrderApi getInstance() { + return new OrderApi(); } - public OrderApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -78,15 +67,15 @@ public com.squareup.okhttp.Call getOrdersCall(BigDecimal displayId, String email List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (displayId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("display_id", displayId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("display_id", displayId)); if (fields != null) - localVarQueryParams.addAll(apiClient.parameterToPair("fields", fields)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("fields", fields)); if (expand != null) - localVarQueryParams.addAll(apiClient.parameterToPair("expand", expand)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("expand", expand)); if (email != null) - localVarQueryParams.addAll(apiClient.parameterToPair("email", email)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("email", email)); if (shippingAddress != null) - localVarQueryParams.addAll(apiClient.parameterToPair("shipping_address", shippingAddress)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("shipping_address", shippingAddress)); Map localVarHeaderParams = new HashMap(); @@ -95,17 +84,17 @@ public com.squareup.okhttp.Call getOrdersCall(BigDecimal displayId, String email final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -117,7 +106,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -170,7 +159,7 @@ public StoreOrdersRes getOrders(BigDecimal displayId, String email, String field public ApiResponse getOrdersWithHttpInfo(BigDecimal displayId, String email, String fields, String expand, ShippingAddress shippingAddress) throws ApiException { com.squareup.okhttp.Call call = getOrdersValidateBeforeCall(displayId, email, fields, expand, shippingAddress, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -208,7 +197,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getOrdersValidateBeforeCall(displayId, email, fields, expand, shippingAddress, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -226,14 +215,14 @@ public com.squareup.okhttp.Call getOrdersOrderCall(String id, String fields, Str // create path and map variables String localVarPath = "/orders/{id}" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (fields != null) - localVarQueryParams.addAll(apiClient.parameterToPair("fields", fields)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("fields", fields)); if (expand != null) - localVarQueryParams.addAll(apiClient.parameterToPair("expand", expand)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("expand", expand)); Map localVarHeaderParams = new HashMap(); @@ -242,17 +231,17 @@ public com.squareup.okhttp.Call getOrdersOrderCall(String id, String fields, Str final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -264,7 +253,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -309,7 +298,7 @@ public StoreOrdersRes getOrdersOrder(String id, String fields, String expand) th public ApiResponse getOrdersOrderWithHttpInfo(String id, String fields, String expand) throws ApiException { com.squareup.okhttp.Call call = getOrdersOrderValidateBeforeCall(id, fields, expand, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -345,7 +334,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getOrdersOrderValidateBeforeCall(id, fields, expand, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -361,7 +350,7 @@ public com.squareup.okhttp.Call getOrdersOrderCartIdCall(String cartId, final Pr // create path and map variables String localVarPath = "/orders/cart/{cart_id}" - .replaceAll("\\{" + "cart_id" + "\\}", apiClient.escapeString(cartId.toString())); + .replaceAll("\\{" + "cart_id" + "\\}", medusaSdkClient.escapeString(cartId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -373,17 +362,17 @@ public com.squareup.okhttp.Call getOrdersOrderCartIdCall(String cartId, final Pr final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -395,7 +384,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -436,7 +425,7 @@ public StoreOrdersRes getOrdersOrderCartId(String cartId) throws ApiException { public ApiResponse getOrdersOrderCartIdWithHttpInfo(String cartId) throws ApiException { com.squareup.okhttp.Call call = getOrdersOrderCartIdValidateBeforeCall(cartId, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -470,7 +459,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getOrdersOrderCartIdValidateBeforeCall(cartId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -497,17 +486,17 @@ public com.squareup.okhttp.Call postOrdersCustomerOrderClaimsCustomerOrderClaimA final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -519,7 +508,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -553,7 +542,7 @@ public void postOrdersCustomerOrderClaimsCustomerOrderClaimAccept(StorePostCusto */ public ApiResponse postOrdersCustomerOrderClaimsCustomerOrderClaimAcceptWithHttpInfo(StorePostCustomersCustomerAcceptClaimReq body) throws ApiException { com.squareup.okhttp.Call call = postOrdersCustomerOrderClaimsCustomerOrderClaimAcceptValidateBeforeCall(body, null, null); - return apiClient.execute(call); + return medusaSdkClient.execute(call); } /** @@ -586,7 +575,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don } com.squareup.okhttp.Call call = postOrdersCustomerOrderClaimsCustomerOrderClaimAcceptValidateBeforeCall(body, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); + medusaSdkClient.executeAsync(call, callback); return call; } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/OrderEditApi.java b/src/main/java/mobi/appcent/medusa/store/api/OrderEditApi.java index 2bd6d81..c93e338 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/OrderEditApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/OrderEditApi.java @@ -12,22 +12,16 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.MedusaSdkClient; import com.google.gson.reflect.TypeToken; import java.io.IOException; -import mobi.appcent.medusa.store.model.StoreOrderEditsRes; -import mobi.appcent.medusa.store.model.StorePostOrderEditsOrderEditDecline; +import mobi.appcent.medusa.store.model.response.StoreOrderEditsRes; +import mobi.appcent.medusa.store.model.response.StorePostOrderEditsOrderEditDecline; import java.lang.reflect.Type; import java.util.ArrayList; @@ -36,22 +30,18 @@ import java.util.Map; public class OrderEditApi { - private ApiClient apiClient; + private MedusaSdkClient medusaSdkClient; - public OrderEditApi() { - this(Configuration.getDefaultApiClient()); + public static OrderEditApi getInstance() { + return new OrderEditApi(); } - public OrderEditApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -67,7 +57,7 @@ public com.squareup.okhttp.Call getOrderEditsOrderEditCall(String id, final Prog // create path and map variables String localVarPath = "/order-edits/{id}" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -79,17 +69,17 @@ public com.squareup.okhttp.Call getOrderEditsOrderEditCall(String id, final Prog final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -101,7 +91,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -142,7 +132,7 @@ public StoreOrderEditsRes getOrderEditsOrderEdit(String id) throws ApiException public ApiResponse getOrderEditsOrderEditWithHttpInfo(String id) throws ApiException { com.squareup.okhttp.Call call = getOrderEditsOrderEditValidateBeforeCall(id, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -176,7 +166,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getOrderEditsOrderEditValidateBeforeCall(id, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -192,7 +182,7 @@ public com.squareup.okhttp.Call postOrderEditsOrderEditCompleteCall(String id, f // create path and map variables String localVarPath = "/order-edits/{id}/complete" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -204,17 +194,17 @@ public com.squareup.okhttp.Call postOrderEditsOrderEditCompleteCall(String id, f final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -226,7 +216,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -267,7 +257,7 @@ public StoreOrderEditsRes postOrderEditsOrderEditComplete(String id) throws ApiE public ApiResponse postOrderEditsOrderEditCompleteWithHttpInfo(String id) throws ApiException { com.squareup.okhttp.Call call = postOrderEditsOrderEditCompleteValidateBeforeCall(id, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -301,7 +291,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postOrderEditsOrderEditCompleteValidateBeforeCall(id, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -318,7 +308,7 @@ public com.squareup.okhttp.Call postOrderEditsOrderEditDeclineCall(String id, St // create path and map variables String localVarPath = "/order-edits/{id}/decline" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -330,17 +320,17 @@ public com.squareup.okhttp.Call postOrderEditsOrderEditDeclineCall(String id, St final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -352,7 +342,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -395,7 +385,7 @@ public StoreOrderEditsRes postOrderEditsOrderEditDecline(String id, StorePostOrd public ApiResponse postOrderEditsOrderEditDeclineWithHttpInfo(String id, StorePostOrderEditsOrderEditDecline body) throws ApiException { com.squareup.okhttp.Call call = postOrderEditsOrderEditDeclineValidateBeforeCall(id, body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -430,7 +420,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postOrderEditsOrderEditDeclineValidateBeforeCall(id, body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/PaymentCollectionApi.java b/src/main/java/mobi/appcent/medusa/store/api/PaymentCollectionApi.java index 8429b1e..a8ed548 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/PaymentCollectionApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/PaymentCollectionApi.java @@ -12,25 +12,19 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.MedusaSdkClient; import com.google.gson.reflect.TypeToken; import java.io.IOException; -import mobi.appcent.medusa.store.model.StorePaymentCollectionSessionsReq; -import mobi.appcent.medusa.store.model.StorePaymentCollectionsRes; -import mobi.appcent.medusa.store.model.StorePaymentCollectionsSessionRes; -import mobi.appcent.medusa.store.model.StorePostPaymentCollectionsBatchSessionsAuthorizeReq; -import mobi.appcent.medusa.store.model.StorePostPaymentCollectionsBatchSessionsReq; +import mobi.appcent.medusa.store.model.response.StorePaymentCollectionSessionsReq; +import mobi.appcent.medusa.store.model.response.StorePaymentCollectionsRes; +import mobi.appcent.medusa.store.model.response.StorePaymentCollectionsSessionRes; +import mobi.appcent.medusa.store.model.response.StorePostPaymentCollectionsBatchSessionsAuthorizeReq; +import mobi.appcent.medusa.store.model.response.StorePostPaymentCollectionsBatchSessionsReq; import java.lang.reflect.Type; import java.util.ArrayList; @@ -39,22 +33,18 @@ import java.util.Map; public class PaymentCollectionApi { - private ApiClient apiClient; + private MedusaSdkClient medusaSdkClient; - public PaymentCollectionApi() { - this(Configuration.getDefaultApiClient()); + public static PaymentCollectionApi getInstance() { + return new PaymentCollectionApi(); } - public PaymentCollectionApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -72,14 +62,14 @@ public com.squareup.okhttp.Call getPaymentCollectionsPaymentCollectionCall(Strin // create path and map variables String localVarPath = "/payment-collections/{id}" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (expand != null) - localVarQueryParams.addAll(apiClient.parameterToPair("expand", expand)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("expand", expand)); if (fields != null) - localVarQueryParams.addAll(apiClient.parameterToPair("fields", fields)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("fields", fields)); Map localVarHeaderParams = new HashMap(); @@ -88,17 +78,17 @@ public com.squareup.okhttp.Call getPaymentCollectionsPaymentCollectionCall(Strin final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -110,7 +100,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -155,7 +145,7 @@ public StorePaymentCollectionsRes getPaymentCollectionsPaymentCollection(String public ApiResponse getPaymentCollectionsPaymentCollectionWithHttpInfo(String id, String expand, String fields) throws ApiException { com.squareup.okhttp.Call call = getPaymentCollectionsPaymentCollectionValidateBeforeCall(id, expand, fields, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -191,7 +181,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getPaymentCollectionsPaymentCollectionValidateBeforeCall(id, expand, fields, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -208,8 +198,8 @@ public com.squareup.okhttp.Call postPaymentCollectionsPaymentCollectionPaymentSe // create path and map variables String localVarPath = "/payment-collections/{id}/sessions/{session_id}" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())) - .replaceAll("\\{" + "session_id" + "\\}", apiClient.escapeString(sessionId.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())) + .replaceAll("\\{" + "session_id" + "\\}", medusaSdkClient.escapeString(sessionId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -221,17 +211,17 @@ public com.squareup.okhttp.Call postPaymentCollectionsPaymentCollectionPaymentSe final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -243,7 +233,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -290,7 +280,7 @@ public StorePaymentCollectionsSessionRes postPaymentCollectionsPaymentCollection public ApiResponse postPaymentCollectionsPaymentCollectionPaymentSessionsSessionWithHttpInfo(String id, String sessionId) throws ApiException { com.squareup.okhttp.Call call = postPaymentCollectionsPaymentCollectionPaymentSessionsSessionValidateBeforeCall(id, sessionId, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -325,7 +315,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postPaymentCollectionsPaymentCollectionPaymentSessionsSessionValidateBeforeCall(id, sessionId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -342,7 +332,7 @@ public com.squareup.okhttp.Call postPaymentCollectionsPaymentCollectionSessionsB // create path and map variables String localVarPath = "/payment-collections/{id}/sessions/batch" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -354,17 +344,17 @@ public com.squareup.okhttp.Call postPaymentCollectionsPaymentCollectionSessionsB final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -376,7 +366,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -419,7 +409,7 @@ public StorePaymentCollectionsRes postPaymentCollectionsPaymentCollectionSession public ApiResponse postPaymentCollectionsPaymentCollectionSessionsBatchWithHttpInfo(String id, StorePostPaymentCollectionsBatchSessionsReq body) throws ApiException { com.squareup.okhttp.Call call = postPaymentCollectionsPaymentCollectionSessionsBatchValidateBeforeCall(id, body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -454,7 +444,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postPaymentCollectionsPaymentCollectionSessionsBatchValidateBeforeCall(id, body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -471,7 +461,7 @@ public com.squareup.okhttp.Call postPaymentCollectionsSessionsCall(String id, St // create path and map variables String localVarPath = "/payment-collections/{id}/sessions" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -483,17 +473,17 @@ public com.squareup.okhttp.Call postPaymentCollectionsSessionsCall(String id, St final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -505,7 +495,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -548,7 +538,7 @@ public StorePaymentCollectionsRes postPaymentCollectionsSessions(String id, Stor public ApiResponse postPaymentCollectionsSessionsWithHttpInfo(String id, StorePaymentCollectionSessionsReq body) throws ApiException { com.squareup.okhttp.Call call = postPaymentCollectionsSessionsValidateBeforeCall(id, body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -583,7 +573,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postPaymentCollectionsSessionsValidateBeforeCall(id, body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -600,7 +590,7 @@ public com.squareup.okhttp.Call postPaymentCollectionsSessionsBatchAuthorizeCall // create path and map variables String localVarPath = "/payment-collections/{id}/sessions/batch/authorize" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -612,17 +602,17 @@ public com.squareup.okhttp.Call postPaymentCollectionsSessionsBatchAuthorizeCall final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -634,7 +624,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -677,7 +667,7 @@ public StorePaymentCollectionsRes postPaymentCollectionsSessionsBatchAuthorize(S public ApiResponse postPaymentCollectionsSessionsBatchAuthorizeWithHttpInfo(String id, StorePostPaymentCollectionsBatchSessionsAuthorizeReq body) throws ApiException { com.squareup.okhttp.Call call = postPaymentCollectionsSessionsBatchAuthorizeValidateBeforeCall(id, body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -712,7 +702,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postPaymentCollectionsSessionsBatchAuthorizeValidateBeforeCall(id, body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -729,8 +719,8 @@ public com.squareup.okhttp.Call postPaymentCollectionsSessionsSessionAuthorizeCa // create path and map variables String localVarPath = "/payment-collections/{id}/sessions/{session_id}/authorize" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())) - .replaceAll("\\{" + "session_id" + "\\}", apiClient.escapeString(sessionId.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())) + .replaceAll("\\{" + "session_id" + "\\}", medusaSdkClient.escapeString(sessionId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -742,17 +732,17 @@ public com.squareup.okhttp.Call postPaymentCollectionsSessionsSessionAuthorizeCa final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -764,7 +754,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -811,7 +801,7 @@ public StorePaymentCollectionsSessionRes postPaymentCollectionsSessionsSessionAu public ApiResponse postPaymentCollectionsSessionsSessionAuthorizeWithHttpInfo(String id, String sessionId) throws ApiException { com.squareup.okhttp.Call call = postPaymentCollectionsSessionsSessionAuthorizeValidateBeforeCall(id, sessionId, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -846,7 +836,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postPaymentCollectionsSessionsSessionAuthorizeValidateBeforeCall(id, sessionId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/ProductApi.java b/src/main/java/mobi/appcent/medusa/store/api/ProductApi.java index fdebc84..5b1d7d8 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ProductApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ProductApi.java @@ -12,26 +12,20 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.MedusaSdkClient; import com.google.gson.reflect.TypeToken; import java.io.IOException; -import mobi.appcent.medusa.store.model.CreatedAt4; -import mobi.appcent.medusa.store.model.Id; -import mobi.appcent.medusa.store.model.StorePostSearchRes; -import mobi.appcent.medusa.store.model.StoreProductsListRes; -import mobi.appcent.medusa.store.model.StoreProductsRes; -import mobi.appcent.medusa.store.model.UpdatedAt4; +import mobi.appcent.medusa.store.model.response.CreatedAt4; +import mobi.appcent.medusa.store.model.response.Id; +import mobi.appcent.medusa.store.model.response.StorePostSearchRes; +import mobi.appcent.medusa.store.model.response.StoreProductsListRes; +import mobi.appcent.medusa.store.model.response.StoreProductsRes; +import mobi.appcent.medusa.store.model.response.UpdatedAt4; import java.lang.reflect.Type; import java.util.ArrayList; @@ -40,22 +34,18 @@ import java.util.Map; public class ProductApi { - private ApiClient apiClient; + private MedusaSdkClient medusaSdkClient; - public ProductApi() { - this(Configuration.getDefaultApiClient()); + public static ProductApi getInstance() { + return new ProductApi(); } - public ProductApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -96,49 +86,49 @@ public com.squareup.okhttp.Call getProductsCall(String q, Id id, List sa List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (q != null) - localVarQueryParams.addAll(apiClient.parameterToPair("q", q)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("q", q)); if (id != null) - localVarQueryParams.addAll(apiClient.parameterToPair("id", id)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("id", id)); if (salesChannelId != null) - localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "sales_channel_id", salesChannelId)); + localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "sales_channel_id", salesChannelId)); if (collectionId != null) - localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "collection_id", collectionId)); + localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "collection_id", collectionId)); if (typeId != null) - localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "type_id", typeId)); + localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "type_id", typeId)); if (tags != null) - localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); + localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "tags", tags)); if (title != null) - localVarQueryParams.addAll(apiClient.parameterToPair("title", title)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("title", title)); if (description != null) - localVarQueryParams.addAll(apiClient.parameterToPair("description", description)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("description", description)); if (handle != null) - localVarQueryParams.addAll(apiClient.parameterToPair("handle", handle)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("handle", handle)); if (isGiftcard != null) - localVarQueryParams.addAll(apiClient.parameterToPair("is_giftcard", isGiftcard)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("is_giftcard", isGiftcard)); if (createdAt != null) - localVarQueryParams.addAll(apiClient.parameterToPair("created_at", createdAt)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("created_at", createdAt)); if (updatedAt != null) - localVarQueryParams.addAll(apiClient.parameterToPair("updated_at", updatedAt)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("updated_at", updatedAt)); if (categoryId != null) - localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "category_id", categoryId)); + localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "category_id", categoryId)); if (includeCategoryChildren != null) - localVarQueryParams.addAll(apiClient.parameterToPair("include_category_children", includeCategoryChildren)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("include_category_children", includeCategoryChildren)); if (offset != null) - localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("offset", offset)); if (limit != null) - localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("limit", limit)); if (expand != null) - localVarQueryParams.addAll(apiClient.parameterToPair("expand", expand)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("expand", expand)); if (fields != null) - localVarQueryParams.addAll(apiClient.parameterToPair("fields", fields)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("fields", fields)); if (order != null) - localVarQueryParams.addAll(apiClient.parameterToPair("order", order)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("order", order)); if (cartId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("cart_id", cartId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("cart_id", cartId)); if (regionId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("region_id", regionId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("region_id", regionId)); if (currencyCode != null) - localVarQueryParams.addAll(apiClient.parameterToPair("currency_code", currencyCode)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("currency_code", currencyCode)); Map localVarHeaderParams = new HashMap(); @@ -147,17 +137,17 @@ public com.squareup.okhttp.Call getProductsCall(String q, Id id, List sa final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -169,7 +159,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -248,7 +238,7 @@ public StoreProductsListRes getProducts(String q, Id id, List salesChann public ApiResponse getProductsWithHttpInfo(String q, Id id, List salesChannelId, List collectionId, List typeId, List tags, String title, String description, String handle, Boolean isGiftcard, CreatedAt4 createdAt, UpdatedAt4 updatedAt, List categoryId, Boolean includeCategoryChildren, Integer offset, Integer limit, String expand, String fields, String order, String cartId, String regionId, String currencyCode) throws ApiException { com.squareup.okhttp.Call call = getProductsValidateBeforeCall(q, id, salesChannelId, collectionId, typeId, tags, title, description, handle, isGiftcard, createdAt, updatedAt, categoryId, includeCategoryChildren, offset, limit, expand, fields, order, cartId, regionId, currencyCode, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -303,7 +293,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getProductsValidateBeforeCall(q, id, salesChannelId, collectionId, typeId, tags, title, description, handle, isGiftcard, createdAt, updatedAt, categoryId, includeCategoryChildren, offset, limit, expand, fields, order, cartId, regionId, currencyCode, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -325,22 +315,22 @@ public com.squareup.okhttp.Call getProductsProductCall(String id, String salesCh // create path and map variables String localVarPath = "/products/{id}" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (salesChannelId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("sales_channel_id", salesChannelId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("sales_channel_id", salesChannelId)); if (cartId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("cart_id", cartId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("cart_id", cartId)); if (regionId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("region_id", regionId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("region_id", regionId)); if (fields != null) - localVarQueryParams.addAll(apiClient.parameterToPair("fields", fields)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("fields", fields)); if (expand != null) - localVarQueryParams.addAll(apiClient.parameterToPair("expand", expand)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("expand", expand)); if (currencyCode != null) - localVarQueryParams.addAll(apiClient.parameterToPair("currency_code", currencyCode)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("currency_code", currencyCode)); Map localVarHeaderParams = new HashMap(); @@ -349,17 +339,17 @@ public com.squareup.okhttp.Call getProductsProductCall(String id, String salesCh final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -371,7 +361,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -424,7 +414,7 @@ public StoreProductsRes getProductsProduct(String id, String salesChannelId, Str public ApiResponse getProductsProductWithHttpInfo(String id, String salesChannelId, String cartId, String regionId, String fields, String expand, String currencyCode) throws ApiException { com.squareup.okhttp.Call call = getProductsProductValidateBeforeCall(id, salesChannelId, cartId, regionId, fields, expand, currencyCode, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -464,7 +454,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getProductsProductValidateBeforeCall(id, salesChannelId, cartId, regionId, fields, expand, currencyCode, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -486,11 +476,11 @@ public com.squareup.okhttp.Call postProductsSearchCall(String q, Integer offset, List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (q != null) - localVarQueryParams.addAll(apiClient.parameterToPair("q", q)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("q", q)); if (offset != null) - localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("offset", offset)); if (limit != null) - localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("limit", limit)); Map localVarHeaderParams = new HashMap(); @@ -499,17 +489,17 @@ public com.squareup.okhttp.Call postProductsSearchCall(String q, Integer offset, final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -521,7 +511,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -566,7 +556,7 @@ public StorePostSearchRes postProductsSearch(String q, Integer offset, Integer l public ApiResponse postProductsSearchWithHttpInfo(String q, Integer offset, Integer limit) throws ApiException { com.squareup.okhttp.Call call = postProductsSearchValidateBeforeCall(q, offset, limit, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -602,7 +592,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postProductsSearchValidateBeforeCall(q, offset, limit, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/ProductCategoryApi.java b/src/main/java/mobi/appcent/medusa/store/api/ProductCategoryApi.java index e3bb99f..069d59b 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ProductCategoryApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ProductCategoryApi.java @@ -12,22 +12,16 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.MedusaSdkClient; import com.google.gson.reflect.TypeToken; import java.io.IOException; -import mobi.appcent.medusa.store.model.StoreGetProductCategoriesCategoryRes; -import mobi.appcent.medusa.store.model.StoreProductCategoriesListRes; +import mobi.appcent.medusa.store.model.response.StoreGetProductCategoriesCategoryRes; +import mobi.appcent.medusa.store.model.response.StoreProductCategoriesListRes; import java.lang.reflect.Type; import java.util.ArrayList; @@ -36,22 +30,18 @@ import java.util.Map; public class ProductCategoryApi { - private ApiClient apiClient; + private MedusaSdkClient medusaSdkClient; - public ProductCategoryApi() { - this(Configuration.getDefaultApiClient()); + public static ProductCategoryApi getInstance() { + return new ProductCategoryApi(); } - public ProductCategoryApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -74,13 +64,13 @@ public com.squareup.okhttp.Call getProductCategoriesCall(String q, String parent List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (q != null) - localVarQueryParams.addAll(apiClient.parameterToPair("q", q)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("q", q)); if (parentCategoryId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("parent_category_id", parentCategoryId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("parent_category_id", parentCategoryId)); if (offset != null) - localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("offset", offset)); if (limit != null) - localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("limit", limit)); Map localVarHeaderParams = new HashMap(); @@ -89,17 +79,17 @@ public com.squareup.okhttp.Call getProductCategoriesCall(String q, String parent final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -111,7 +101,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -154,7 +144,7 @@ public StoreProductCategoriesListRes getProductCategories(String q, String paren public ApiResponse getProductCategoriesWithHttpInfo(String q, String parentCategoryId, Integer offset, Integer limit) throws ApiException { com.squareup.okhttp.Call call = getProductCategoriesValidateBeforeCall(q, parentCategoryId, offset, limit, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -191,7 +181,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getProductCategoriesValidateBeforeCall(q, parentCategoryId, offset, limit, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -209,14 +199,14 @@ public com.squareup.okhttp.Call getProductCategoriesCategoryCall(String id, Stri // create path and map variables String localVarPath = "/product-categories/{id}" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (expand != null) - localVarQueryParams.addAll(apiClient.parameterToPair("expand", expand)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("expand", expand)); if (fields != null) - localVarQueryParams.addAll(apiClient.parameterToPair("fields", fields)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("fields", fields)); Map localVarHeaderParams = new HashMap(); @@ -225,17 +215,17 @@ public com.squareup.okhttp.Call getProductCategoriesCategoryCall(String id, Stri final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -247,7 +237,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -292,7 +282,7 @@ public StoreGetProductCategoriesCategoryRes getProductCategoriesCategory(String public ApiResponse getProductCategoriesCategoryWithHttpInfo(String id, String expand, String fields) throws ApiException { com.squareup.okhttp.Call call = getProductCategoriesCategoryValidateBeforeCall(id, expand, fields, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -328,7 +318,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getProductCategoriesCategoryValidateBeforeCall(id, expand, fields, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/ProductTagApi.java b/src/main/java/mobi/appcent/medusa/store/api/ProductTagApi.java index e8e3332..0adcaa5 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ProductTagApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ProductTagApi.java @@ -12,23 +12,17 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.MedusaSdkClient; import com.google.gson.reflect.TypeToken; import java.io.IOException; -import mobi.appcent.medusa.store.model.CreatedAt2; -import mobi.appcent.medusa.store.model.InlineResponse200; -import mobi.appcent.medusa.store.model.UpdatedAt2; +import mobi.appcent.medusa.store.model.response.CreatedAt2; +import mobi.appcent.medusa.store.model.response.InlineResponse200; +import mobi.appcent.medusa.store.model.response.UpdatedAt2; import java.lang.reflect.Type; import java.util.ArrayList; @@ -37,22 +31,18 @@ import java.util.Map; public class ProductTagApi { - private ApiClient apiClient; + private MedusaSdkClient medusaSdkClient; - public ProductTagApi() { - this(Configuration.getDefaultApiClient()); + public static ProductTagApi getInstance() { + return new ProductTagApi(); } - public ProductTagApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -80,23 +70,23 @@ public com.squareup.okhttp.Call getProductTagsCall(Integer limit, Integer offset List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (limit != null) - localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("limit", limit)); if (offset != null) - localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("offset", offset)); if (order != null) - localVarQueryParams.addAll(apiClient.parameterToPair("order", order)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("order", order)); if (discountConditionId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("discount_condition_id", discountConditionId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("discount_condition_id", discountConditionId)); if (value != null) - localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "value", value)); + localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "value", value)); if (id != null) - localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "id", id)); + localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "id", id)); if (q != null) - localVarQueryParams.addAll(apiClient.parameterToPair("q", q)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("q", q)); if (createdAt != null) - localVarQueryParams.addAll(apiClient.parameterToPair("created_at", createdAt)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("created_at", createdAt)); if (updatedAt != null) - localVarQueryParams.addAll(apiClient.parameterToPair("updated_at", updatedAt)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("updated_at", updatedAt)); Map localVarHeaderParams = new HashMap(); @@ -105,17 +95,17 @@ public com.squareup.okhttp.Call getProductTagsCall(Integer limit, Integer offset final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -127,7 +117,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -180,7 +170,7 @@ public InlineResponse200 getProductTags(Integer limit, Integer offset, String or public ApiResponse getProductTagsWithHttpInfo(Integer limit, Integer offset, String order, String discountConditionId, List value, List id, String q, CreatedAt2 createdAt, UpdatedAt2 updatedAt) throws ApiException { com.squareup.okhttp.Call call = getProductTagsValidateBeforeCall(limit, offset, order, discountConditionId, value, id, q, createdAt, updatedAt, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -222,7 +212,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getProductTagsValidateBeforeCall(limit, offset, order, discountConditionId, value, id, q, createdAt, updatedAt, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/ProductTypeApi.java b/src/main/java/mobi/appcent/medusa/store/api/ProductTypeApi.java index 9b3f4c4..bd7e9f2 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ProductTypeApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ProductTypeApi.java @@ -12,23 +12,16 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; import com.google.gson.reflect.TypeToken; import java.io.IOException; -import mobi.appcent.medusa.store.model.CreatedAt3; -import mobi.appcent.medusa.store.model.StoreProductTypesListRes; -import mobi.appcent.medusa.store.model.UpdatedAt3; +import mobi.appcent.medusa.store.model.response.CreatedAt3; +import mobi.appcent.medusa.store.model.response.StoreProductTypesListRes; +import mobi.appcent.medusa.store.model.response.UpdatedAt3; import java.lang.reflect.Type; import java.util.ArrayList; @@ -37,22 +30,18 @@ import java.util.Map; public class ProductTypeApi { - private ApiClient apiClient; + private MedusaSdkClient medusaSdkClient; - public ProductTypeApi() { - this(Configuration.getDefaultApiClient()); + public static ProductTypeApi getInstance() { + return new ProductTypeApi(); } - public ProductTypeApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -80,23 +69,23 @@ public com.squareup.okhttp.Call getProductTypesCall(Integer limit, Integer offse List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (limit != null) - localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("limit", limit)); if (offset != null) - localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("offset", offset)); if (order != null) - localVarQueryParams.addAll(apiClient.parameterToPair("order", order)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("order", order)); if (discountConditionId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("discount_condition_id", discountConditionId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("discount_condition_id", discountConditionId)); if (value != null) - localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "value", value)); + localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "value", value)); if (id != null) - localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "id", id)); + localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "id", id)); if (q != null) - localVarQueryParams.addAll(apiClient.parameterToPair("q", q)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("q", q)); if (createdAt != null) - localVarQueryParams.addAll(apiClient.parameterToPair("created_at", createdAt)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("created_at", createdAt)); if (updatedAt != null) - localVarQueryParams.addAll(apiClient.parameterToPair("updated_at", updatedAt)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("updated_at", updatedAt)); Map localVarHeaderParams = new HashMap(); @@ -105,17 +94,17 @@ public com.squareup.okhttp.Call getProductTypesCall(Integer limit, Integer offse final String[] localVarAccepts = { "application/json", "text/plain" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -127,7 +116,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { "cookie_auth" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -180,7 +169,7 @@ public StoreProductTypesListRes getProductTypes(Integer limit, Integer offset, S public ApiResponse getProductTypesWithHttpInfo(Integer limit, Integer offset, String order, String discountConditionId, List value, List id, String q, CreatedAt3 createdAt, UpdatedAt3 updatedAt) throws ApiException { com.squareup.okhttp.Call call = getProductTypesValidateBeforeCall(limit, offset, order, discountConditionId, value, id, q, createdAt, updatedAt, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -222,7 +211,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getProductTypesValidateBeforeCall(limit, offset, order, discountConditionId, value, id, q, createdAt, updatedAt, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/ProductVariantApi.java b/src/main/java/mobi/appcent/medusa/store/api/ProductVariantApi.java index fc0287a..835ec07 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ProductVariantApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ProductVariantApi.java @@ -12,14 +12,7 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; import com.google.gson.reflect.TypeToken; @@ -28,10 +21,10 @@ import java.math.BigDecimal; -import mobi.appcent.medusa.store.model.InventoryQuantity; -import mobi.appcent.medusa.store.model.StoreVariantsListRes; -import mobi.appcent.medusa.store.model.StoreVariantsRes; -import mobi.appcent.medusa.store.model.Title; +import mobi.appcent.medusa.store.model.response.InventoryQuantity; +import mobi.appcent.medusa.store.model.response.StoreVariantsListRes; +import mobi.appcent.medusa.store.model.response.StoreVariantsRes; +import mobi.appcent.medusa.store.model.response.Title; import java.lang.reflect.Type; import java.util.ArrayList; @@ -40,22 +33,18 @@ import java.util.Map; public class ProductVariantApi { - private ApiClient apiClient; + private MedusaSdkClient medusaSdkClient; - public ProductVariantApi() { - this(Configuration.getDefaultApiClient()); + public static ProductVariantApi getInstance() { + return new ProductVariantApi(); } - public ProductVariantApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -84,25 +73,25 @@ public com.squareup.okhttp.Call getVariantsCall(String ids, String salesChannelI List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (ids != null) - localVarQueryParams.addAll(apiClient.parameterToPair("ids", ids)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("ids", ids)); if (salesChannelId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("sales_channel_id", salesChannelId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("sales_channel_id", salesChannelId)); if (expand != null) - localVarQueryParams.addAll(apiClient.parameterToPair("expand", expand)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("expand", expand)); if (offset != null) - localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("offset", offset)); if (limit != null) - localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("limit", limit)); if (cartId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("cart_id", cartId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("cart_id", cartId)); if (regionId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("region_id", regionId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("region_id", regionId)); if (currencyCode != null) - localVarQueryParams.addAll(apiClient.parameterToPair("currency_code", currencyCode)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("currency_code", currencyCode)); if (title != null) - localVarQueryParams.addAll(apiClient.parameterToPair("title", title)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("title", title)); if (inventoryQuantity != null) - localVarQueryParams.addAll(apiClient.parameterToPair("inventory_quantity", inventoryQuantity)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("inventory_quantity", inventoryQuantity)); Map localVarHeaderParams = new HashMap(); @@ -111,17 +100,17 @@ public com.squareup.okhttp.Call getVariantsCall(String ids, String salesChannelI final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -133,7 +122,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -188,7 +177,7 @@ public StoreVariantsListRes getVariants(String ids, String salesChannelId, Strin public ApiResponse getVariantsWithHttpInfo(String ids, String salesChannelId, String expand, BigDecimal offset, BigDecimal limit, String cartId, String regionId, String currencyCode, Title title, InventoryQuantity inventoryQuantity) throws ApiException { com.squareup.okhttp.Call call = getVariantsValidateBeforeCall(ids, salesChannelId, expand, offset, limit, cartId, regionId, currencyCode, title, inventoryQuantity, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -231,7 +220,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getVariantsValidateBeforeCall(ids, salesChannelId, expand, offset, limit, cartId, regionId, currencyCode, title, inventoryQuantity, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -251,18 +240,18 @@ public com.squareup.okhttp.Call getVariantsVariantCall(String variantId, String // create path and map variables String localVarPath = "/variants/{variant_id}" - .replaceAll("\\{" + "variant_id" + "\\}", apiClient.escapeString(variantId.toString())); + .replaceAll("\\{" + "variant_id" + "\\}", medusaSdkClient.escapeString(variantId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (cartId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("cart_id", cartId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("cart_id", cartId)); if (salesChannelId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("sales_channel_id", salesChannelId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("sales_channel_id", salesChannelId)); if (regionId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("region_id", regionId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("region_id", regionId)); if (currencyCode != null) - localVarQueryParams.addAll(apiClient.parameterToPair("currency_code", currencyCode)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("currency_code", currencyCode)); Map localVarHeaderParams = new HashMap(); @@ -271,17 +260,17 @@ public com.squareup.okhttp.Call getVariantsVariantCall(String variantId, String final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -293,7 +282,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -342,7 +331,7 @@ public StoreVariantsRes getVariantsVariant(String variantId, String cartId, Stri public ApiResponse getVariantsVariantWithHttpInfo(String variantId, String cartId, String salesChannelId, String regionId, String currencyCode) throws ApiException { com.squareup.okhttp.Call call = getVariantsVariantValidateBeforeCall(variantId, cartId, salesChannelId, regionId, currencyCode, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -380,7 +369,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getVariantsVariantValidateBeforeCall(variantId, cartId, salesChannelId, regionId, currencyCode, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/RegionApi.java b/src/main/java/mobi/appcent/medusa/store/api/RegionApi.java index ce317a3..533ce32 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/RegionApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/RegionApi.java @@ -12,24 +12,17 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; import com.google.gson.reflect.TypeToken; import java.io.IOException; -import mobi.appcent.medusa.store.model.CreatedAt5; -import mobi.appcent.medusa.store.model.StoreRegionsListRes; -import mobi.appcent.medusa.store.model.StoreRegionsRes; -import mobi.appcent.medusa.store.model.UpdatedAt5; +import mobi.appcent.medusa.store.model.response.CreatedAt5; +import mobi.appcent.medusa.store.model.response.StoreRegionsListRes; +import mobi.appcent.medusa.store.model.response.StoreRegionsRes; +import mobi.appcent.medusa.store.model.response.UpdatedAt5; import java.lang.reflect.Type; import java.util.ArrayList; @@ -38,22 +31,18 @@ import java.util.Map; public class RegionApi { - private ApiClient apiClient; + private MedusaSdkClient medusaSdkClient; - public RegionApi() { - this(Configuration.getDefaultApiClient()); + public static RegionApi getInstance() { + return new RegionApi(); } - public RegionApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -76,13 +65,13 @@ public com.squareup.okhttp.Call getRegionsCall(Integer offset, Integer limit, Cr List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (offset != null) - localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("offset", offset)); if (limit != null) - localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("limit", limit)); if (createdAt != null) - localVarQueryParams.addAll(apiClient.parameterToPair("created_at", createdAt)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("created_at", createdAt)); if (updatedAt != null) - localVarQueryParams.addAll(apiClient.parameterToPair("updated_at", updatedAt)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("updated_at", updatedAt)); Map localVarHeaderParams = new HashMap(); @@ -91,17 +80,17 @@ public com.squareup.okhttp.Call getRegionsCall(Integer offset, Integer limit, Cr final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -113,7 +102,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -156,7 +145,7 @@ public StoreRegionsListRes getRegions(Integer offset, Integer limit, CreatedAt5 public ApiResponse getRegionsWithHttpInfo(Integer offset, Integer limit, CreatedAt5 createdAt, UpdatedAt5 updatedAt) throws ApiException { com.squareup.okhttp.Call call = getRegionsValidateBeforeCall(offset, limit, createdAt, updatedAt, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -193,7 +182,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getRegionsValidateBeforeCall(offset, limit, createdAt, updatedAt, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -209,7 +198,7 @@ public com.squareup.okhttp.Call getRegionsRegionCall(String id, final ProgressRe // create path and map variables String localVarPath = "/regions/{id}" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -221,17 +210,17 @@ public com.squareup.okhttp.Call getRegionsRegionCall(String id, final ProgressRe final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -243,7 +232,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -284,7 +273,7 @@ public StoreRegionsRes getRegionsRegion(String id) throws ApiException { public ApiResponse getRegionsRegionWithHttpInfo(String id) throws ApiException { com.squareup.okhttp.Call call = getRegionsRegionValidateBeforeCall(id, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -318,7 +307,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getRegionsRegionValidateBeforeCall(id, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/ReturnApi.java b/src/main/java/mobi/appcent/medusa/store/api/ReturnApi.java index a725ba8..8ac1334 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ReturnApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ReturnApi.java @@ -12,22 +12,15 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; import com.google.gson.reflect.TypeToken; import java.io.IOException; -import mobi.appcent.medusa.store.model.StorePostReturnsReq; -import mobi.appcent.medusa.store.model.StoreReturnsRes; +import mobi.appcent.medusa.store.model.response.StorePostReturnsReq; +import mobi.appcent.medusa.store.model.response.StoreReturnsRes; import java.lang.reflect.Type; import java.util.ArrayList; @@ -36,22 +29,18 @@ import java.util.Map; public class ReturnApi { - private ApiClient apiClient; + private MedusaSdkClient medusaSdkClient; - public ReturnApi() { - this(Configuration.getDefaultApiClient()); + public static ReturnApi getInstance() { + return new ReturnApi(); } - public ReturnApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -78,17 +67,17 @@ public com.squareup.okhttp.Call postReturnsCall(StorePostReturnsReq body, final final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -100,7 +89,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -137,7 +126,7 @@ public StoreReturnsRes postReturns(StorePostReturnsReq body) throws ApiException public ApiResponse postReturnsWithHttpInfo(StorePostReturnsReq body) throws ApiException { com.squareup.okhttp.Call call = postReturnsValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -171,7 +160,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postReturnsValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/ReturnReasonApi.java b/src/main/java/mobi/appcent/medusa/store/api/ReturnReasonApi.java index 61dd8a5..3966780 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ReturnReasonApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ReturnReasonApi.java @@ -12,22 +12,16 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.MedusaSdkClient; import com.google.gson.reflect.TypeToken; import java.io.IOException; -import mobi.appcent.medusa.store.model.StoreReturnReasonsListRes; -import mobi.appcent.medusa.store.model.StoreReturnReasonsRes; +import mobi.appcent.medusa.store.model.response.StoreReturnReasonsListRes; +import mobi.appcent.medusa.store.model.response.StoreReturnReasonsRes; import java.lang.reflect.Type; import java.util.ArrayList; @@ -36,22 +30,18 @@ import java.util.Map; public class ReturnReasonApi { - private ApiClient apiClient; + private MedusaSdkClient medusaSdkClient; - public ReturnReasonApi() { - this(Configuration.getDefaultApiClient()); + public static ReturnReasonApi getInstance() { + return new ReturnReasonApi(); } - public ReturnReasonApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -77,17 +67,17 @@ public com.squareup.okhttp.Call getReturnReasonsCall(final ProgressResponseBody. final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -99,7 +89,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -134,7 +124,7 @@ public StoreReturnReasonsListRes getReturnReasons() throws ApiException { public ApiResponse getReturnReasonsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getReturnReasonsValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -167,7 +157,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getReturnReasonsValidateBeforeCall(progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -183,7 +173,7 @@ public com.squareup.okhttp.Call getReturnReasonsReasonCall(String id, final Prog // create path and map variables String localVarPath = "/return-reasons/{id}" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -195,17 +185,17 @@ public com.squareup.okhttp.Call getReturnReasonsReasonCall(String id, final Prog final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -217,7 +207,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -258,7 +248,7 @@ public StoreReturnReasonsRes getReturnReasonsReason(String id) throws ApiExcepti public ApiResponse getReturnReasonsReasonWithHttpInfo(String id) throws ApiException { com.squareup.okhttp.Call call = getReturnReasonsReasonValidateBeforeCall(id, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -292,7 +282,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getReturnReasonsReasonValidateBeforeCall(id, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/ShippingOptionApi.java b/src/main/java/mobi/appcent/medusa/store/api/ShippingOptionApi.java index 06e58d0..6a549dd 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ShippingOptionApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ShippingOptionApi.java @@ -12,21 +12,14 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; import com.google.gson.reflect.TypeToken; import java.io.IOException; -import mobi.appcent.medusa.store.model.StoreShippingOptionsListRes; +import mobi.appcent.medusa.store.model.response.StoreShippingOptionsListRes; import java.lang.reflect.Type; import java.util.ArrayList; @@ -35,22 +28,18 @@ import java.util.Map; public class ShippingOptionApi { - private ApiClient apiClient; + private MedusaSdkClient medusaSdkClient; - public ShippingOptionApi() { - this(Configuration.getDefaultApiClient()); + public static ShippingOptionApi getInstance() { + return new ShippingOptionApi(); } - public ShippingOptionApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -72,11 +61,11 @@ public com.squareup.okhttp.Call getShippingOptionsCall(Boolean isReturn, String List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (isReturn != null) - localVarQueryParams.addAll(apiClient.parameterToPair("is_return", isReturn)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("is_return", isReturn)); if (productIds != null) - localVarQueryParams.addAll(apiClient.parameterToPair("product_ids", productIds)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("product_ids", productIds)); if (regionId != null) - localVarQueryParams.addAll(apiClient.parameterToPair("region_id", regionId)); + localVarQueryParams.addAll(medusaSdkClient.parameterToPair("region_id", regionId)); Map localVarHeaderParams = new HashMap(); @@ -85,17 +74,17 @@ public com.squareup.okhttp.Call getShippingOptionsCall(Boolean isReturn, String final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -107,7 +96,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -148,7 +137,7 @@ public StoreShippingOptionsListRes getShippingOptions(Boolean isReturn, String p public ApiResponse getShippingOptionsWithHttpInfo(Boolean isReturn, String productIds, String regionId) throws ApiException { com.squareup.okhttp.Call call = getShippingOptionsValidateBeforeCall(isReturn, productIds, regionId, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -184,7 +173,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getShippingOptionsValidateBeforeCall(isReturn, productIds, regionId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -200,7 +189,7 @@ public com.squareup.okhttp.Call getShippingOptionsCartIdCall(String cartId, fina // create path and map variables String localVarPath = "/shipping-options/{cart_id}" - .replaceAll("\\{" + "cart_id" + "\\}", apiClient.escapeString(cartId.toString())); + .replaceAll("\\{" + "cart_id" + "\\}", medusaSdkClient.escapeString(cartId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -212,17 +201,17 @@ public com.squareup.okhttp.Call getShippingOptionsCartIdCall(String cartId, fina final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -234,7 +223,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -275,7 +264,7 @@ public StoreShippingOptionsListRes getShippingOptionsCartId(String cartId) throw public ApiResponse getShippingOptionsCartIdWithHttpInfo(String cartId) throws ApiException { com.squareup.okhttp.Call call = getShippingOptionsCartIdValidateBeforeCall(cartId, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -309,7 +298,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getShippingOptionsCartIdValidateBeforeCall(cartId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/SwapApi.java b/src/main/java/mobi/appcent/medusa/store/api/SwapApi.java index 0347e7d..2a683bf 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/SwapApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/SwapApi.java @@ -12,22 +12,16 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.ApiCallback; -import mobi.appcent.medusa.store.ApiClient; -import mobi.appcent.medusa.store.ApiException; -import mobi.appcent.medusa.store.ApiResponse; -import mobi.appcent.medusa.store.Configuration; -import mobi.appcent.medusa.store.Pair; -import mobi.appcent.medusa.store.ProgressRequestBody; -import mobi.appcent.medusa.store.ProgressResponseBody; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.MedusaSdkClient; import com.google.gson.reflect.TypeToken; import java.io.IOException; -import mobi.appcent.medusa.store.model.StorePostSwapsReq; -import mobi.appcent.medusa.store.model.StoreSwapsRes; +import mobi.appcent.medusa.store.model.response.StorePostSwapsReq; +import mobi.appcent.medusa.store.model.response.StoreSwapsRes; import java.lang.reflect.Type; import java.util.ArrayList; @@ -36,22 +30,18 @@ import java.util.Map; public class SwapApi { - private ApiClient apiClient; + private MedusaSdkClient medusaSdkClient; - public SwapApi() { - this(Configuration.getDefaultApiClient()); + public static SwapApi getInstance() { + return new SwapApi(); } - public SwapApi(ApiClient apiClient) { - this.apiClient = apiClient; + public MedusaSdkClient getApiClient() { + return medusaSdkClient; } - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + public void setApiClient(MedusaSdkClient medusaSdkClient) { + this.medusaSdkClient = medusaSdkClient; } /** @@ -67,7 +57,7 @@ public com.squareup.okhttp.Call getSwapsSwapCartIdCall(String cartId, final Prog // create path and map variables String localVarPath = "/swaps/{cart_id}" - .replaceAll("\\{" + "cart_id" + "\\}", apiClient.escapeString(cartId.toString())); + .replaceAll("\\{" + "cart_id" + "\\}", medusaSdkClient.escapeString(cartId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -79,17 +69,17 @@ public com.squareup.okhttp.Call getSwapsSwapCartIdCall(String cartId, final Prog final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -101,7 +91,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -142,7 +132,7 @@ public StoreSwapsRes getSwapsSwapCartId(String cartId) throws ApiException { public ApiResponse getSwapsSwapCartIdWithHttpInfo(String cartId) throws ApiException { com.squareup.okhttp.Call call = getSwapsSwapCartIdValidateBeforeCall(cartId, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -176,7 +166,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = getSwapsSwapCartIdValidateBeforeCall(cartId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } /** @@ -203,17 +193,17 @@ public com.squareup.okhttp.Call postSwapsCall(StorePostSwapsReq body, final Prog final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); @@ -225,7 +215,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") @@ -262,7 +252,7 @@ public StoreSwapsRes postSwaps(StorePostSwapsReq body) throws ApiException { public ApiResponse postSwapsWithHttpInfo(StorePostSwapsReq body) throws ApiException { com.squareup.okhttp.Call call = postSwapsValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); + return medusaSdkClient.execute(call, localVarReturnType); } /** @@ -296,7 +286,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don com.squareup.okhttp.Call call = postSwapsValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); + medusaSdkClient.executeAsync(call, localVarReturnType, callback); return call; } } diff --git a/src/main/java/mobi/appcent/medusa/store/auth/OAuth.java b/src/main/java/mobi/appcent/medusa/store/auth/OAuth.java index 475bd71..c0ec2c8 100644 --- a/src/main/java/mobi/appcent/medusa/store/auth/OAuth.java +++ b/src/main/java/mobi/appcent/medusa/store/auth/OAuth.java @@ -17,7 +17,8 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2023-02-24T12:45:51.835798768Z[GMT]")public class OAuth implements Authentication { +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2023-02-24T12:45:51.835798768Z[GMT]") +public class OAuth implements Authentication { private String accessToken; public String getAccessToken() { diff --git a/src/main/java/mobi/appcent/medusa/store/common/HeaderConstant.java b/src/main/java/mobi/appcent/medusa/store/common/HeaderConstant.java new file mode 100644 index 0000000..89e1731 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/common/HeaderConstant.java @@ -0,0 +1,11 @@ +package mobi.appcent.medusa.store.common; + +/** + * Created by erenalpaslan on 4.03.2023 + */ +public class HeaderConstant { + public static final String CONTENT_TYPE = "Content-Type"; + public static final String APPLICATION_JSON = "application/json"; + public static final String TEXT_PLAIN = "text/plain"; + public static final String ACCEPT = "Accept"; +} diff --git a/src/main/java/mobi/appcent/medusa/store/common/HttpMethod.java b/src/main/java/mobi/appcent/medusa/store/common/HttpMethod.java new file mode 100644 index 0000000..6e2b407 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/common/HttpMethod.java @@ -0,0 +1,11 @@ +package mobi.appcent.medusa.store.common; + +/** + * Created by erenalpaslan on 4.03.2023 + */ +public class HttpMethod { + public static final String GET = "GET"; + public static final String POST = "POST"; + public static final String DELETE = "DELETE"; + public static final String UPDATE = "UPDATE"; +} diff --git a/src/main/java/mobi/appcent/medusa/store/common/UrlConstant.java b/src/main/java/mobi/appcent/medusa/store/common/UrlConstant.java new file mode 100644 index 0000000..084590a --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/common/UrlConstant.java @@ -0,0 +1,27 @@ +package mobi.appcent.medusa.store.common; + +import mobi.appcent.medusa.store.MedusaApi; + +/** + * Created by erenalpaslan on 4.03.2023 + */ +public class UrlConstant { + public static final String AUTH_PATH = "/auth"; + public static final String CART_PATH = "/carts"; + public static final String COLLECTION_PATH = "/collections"; + public static final String CUSTOMER_PATH = "/customers"; + public static final String GIFT_CARD_PATH = "/gift-cards"; + public static final String ORDER_PATH = "/orders"; + public static final String ORDER_EDIT_PATH = "/order-edits"; + public static final String PAYMENT_COLLECTION_PATH = "/payment-collections"; + public static final String PRODUCT_PATH = "/products"; + public static final String PRODUCT_CATEGORY_PATH = "/product-categories"; + public static final String PRODUCT_TAG_PATH = "/product-tags"; + public static final String PRODUCT_TYPE_PATH = "/product-types"; + public static final String PRODUCT_VARIANTS_PATH = "/variants"; + public static final String REGION_PATH = "/regions"; + public static final String RETURN_PATH = "/returns"; + public static final String RETURN_REASON_PATH = "/return-reasons"; + public static final String SHIPPING_OPTION_PATH = "/shipping-options"; + public static final String SWAP_PATH = "/swaps"; +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/BaseRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/BaseRequest.java new file mode 100644 index 0000000..a23c7df --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/BaseRequest.java @@ -0,0 +1,20 @@ +package mobi.appcent.medusa.store.model.request; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.ApiCallback; +import mobi.appcent.medusa.store.ApiException; +import mobi.appcent.medusa.store.ApiResponse; +import mobi.appcent.medusa.store.MedusaSdkClient; + +/** + * Created by erenalpaslan on 4.03.2023 + */ +abstract public class BaseRequest { + + protected abstract Call buildCall() throws ApiException; + + public abstract ApiResponse execute() throws ApiException; + + public abstract void executeAsync(final ApiCallback callback) throws ApiException; + +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/auth/DeleteAuthRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/auth/DeleteAuthRequest.java new file mode 100644 index 0000000..fea9299 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/auth/DeleteAuthRequest.java @@ -0,0 +1,53 @@ +package mobi.appcent.medusa.store.model.request.auth; + +import com.google.gson.reflect.TypeToken; +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by erenalpaslan on 4.03.2023 + */ +public class DeleteAuthRequest extends BaseRequest { + + private final MedusaSdkClient client; + + public DeleteAuthRequest(MedusaSdkClient client) { + this.client = client; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.AUTH_PATH; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.DELETE, null, null, null, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + Type type = new TypeToken>(){}.getType(); + client.executeAsync(call, type, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/auth/GetAuthEmailRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/auth/GetAuthEmailRequest.java new file mode 100644 index 0000000..60ec047 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/auth/GetAuthEmailRequest.java @@ -0,0 +1,57 @@ +package mobi.appcent.medusa.store.model.request.auth; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreGetAuthEmailRes; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by erenalpaslan on 5.03.2023 + */ +public class GetAuthEmailRequest extends BaseRequest { + + private final MedusaSdkClient client; + private String email; + + public GetAuthEmailRequest(MedusaSdkClient client) { + this.client = client; + } + + public GetAuthEmailRequest email(String email) { + this.email = email; + return this; + } + + + @Override + protected Call buildCall() throws ApiException { + // create path and map variables + String path = UrlConstant.AUTH_PATH + "/" + email; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/auth/GetAuthRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/auth/GetAuthRequest.java new file mode 100644 index 0000000..564f601 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/auth/GetAuthRequest.java @@ -0,0 +1,51 @@ +package mobi.appcent.medusa.store.model.request.auth; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreAuthRes; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by erenalpaslan on 5.03.2023 + */ +public class GetAuthRequest extends BaseRequest { + + private final MedusaSdkClient client; + + public GetAuthRequest(MedusaSdkClient client) { + this.client = client; + } + + @Override + protected Call buildCall() throws ApiException { + + String path = UrlConstant.AUTH_PATH; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/auth/PostAuthRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/auth/PostAuthRequest.java new file mode 100644 index 0000000..4b50b84 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/auth/PostAuthRequest.java @@ -0,0 +1,67 @@ +package mobi.appcent.medusa.store.model.request.auth; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreAuthRes; +import mobi.appcent.medusa.store.model.response.StorePostAuthReq; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by erenalpaslan on 5.03.2023 + */ +public class PostAuthRequest extends BaseRequest { + + private final MedusaSdkClient client; + private String email; + private String password; + + public PostAuthRequest(MedusaSdkClient client) { + this.client = client; + } + + public PostAuthRequest email(String email) { + this.email = email; + return this; + } + + public PostAuthRequest password(String password) { + this.password = password; + return this; + } + + + @Override + protected Call buildCall() throws ApiException { + Object body = new StorePostAuthReq() + .email(email) + .password(password); + + // create path and map variables + String path = UrlConstant.AUTH_PATH; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/Address.java b/src/main/java/mobi/appcent/medusa/store/model/response/Address.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Address.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Address.java index 57351a0..46744ff 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Address.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Address.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/AddressFields.java b/src/main/java/mobi/appcent/medusa/store/model/response/AddressFields.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/AddressFields.java rename to src/main/java/mobi/appcent/medusa/store/model/response/AddressFields.java index 7d7e3c3..cabc975 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/AddressFields.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/AddressFields.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/AllOfBatchJobResult.java b/src/main/java/mobi/appcent/medusa/store/model/response/AllOfBatchJobResult.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/AllOfBatchJobResult.java rename to src/main/java/mobi/appcent/medusa/store/model/response/AllOfBatchJobResult.java index 96e70f7..aa8783f 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/AllOfBatchJobResult.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/AllOfBatchJobResult.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/AllOfCreateStockLocationInputAddress.java b/src/main/java/mobi/appcent/medusa/store/model/response/AllOfCreateStockLocationInputAddress.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/AllOfCreateStockLocationInputAddress.java rename to src/main/java/mobi/appcent/medusa/store/model/response/AllOfCreateStockLocationInputAddress.java index 83f2519..b26a289 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/AllOfCreateStockLocationInputAddress.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/AllOfCreateStockLocationInputAddress.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/AllOfStockLocationDTOAddress.java b/src/main/java/mobi/appcent/medusa/store/model/response/AllOfStockLocationDTOAddress.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/AllOfStockLocationDTOAddress.java rename to src/main/java/mobi/appcent/medusa/store/model/response/AllOfStockLocationDTOAddress.java index 9374f69..3f5a95c 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/AllOfStockLocationDTOAddress.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/AllOfStockLocationDTOAddress.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/AllOfStorePostCustomersCustomerAddressesReqAddress.java b/src/main/java/mobi/appcent/medusa/store/model/response/AllOfStorePostCustomersCustomerAddressesReqAddress.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/AllOfStorePostCustomersCustomerAddressesReqAddress.java rename to src/main/java/mobi/appcent/medusa/store/model/response/AllOfStorePostCustomersCustomerAddressesReqAddress.java index ba53aa6..fd552ba 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/AllOfStorePostCustomersCustomerAddressesReqAddress.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/AllOfStorePostCustomersCustomerAddressesReqAddress.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/AllOfUpdateStockLocationInputAddress.java b/src/main/java/mobi/appcent/medusa/store/model/response/AllOfUpdateStockLocationInputAddress.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/AllOfUpdateStockLocationInputAddress.java rename to src/main/java/mobi/appcent/medusa/store/model/response/AllOfUpdateStockLocationInputAddress.java index 8f8c3b8..9813939 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/AllOfUpdateStockLocationInputAddress.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/AllOfUpdateStockLocationInputAddress.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/AnyOfStorePostCartsCartReqBillingAddress.java b/src/main/java/mobi/appcent/medusa/store/model/response/AnyOfStorePostCartsCartReqBillingAddress.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/AnyOfStorePostCartsCartReqBillingAddress.java rename to src/main/java/mobi/appcent/medusa/store/model/response/AnyOfStorePostCartsCartReqBillingAddress.java index a24e590..1d9d246 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/AnyOfStorePostCartsCartReqBillingAddress.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/AnyOfStorePostCartsCartReqBillingAddress.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; /** * AnyOfStorePostCartsCartReqBillingAddress diff --git a/src/main/java/mobi/appcent/medusa/store/model/AnyOfStorePostCartsCartReqShippingAddress.java b/src/main/java/mobi/appcent/medusa/store/model/response/AnyOfStorePostCartsCartReqShippingAddress.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/AnyOfStorePostCartsCartReqShippingAddress.java rename to src/main/java/mobi/appcent/medusa/store/model/response/AnyOfStorePostCartsCartReqShippingAddress.java index 45cc6e0..30fe071 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/AnyOfStorePostCartsCartReqShippingAddress.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/AnyOfStorePostCartsCartReqShippingAddress.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; /** * AnyOfStorePostCartsCartReqShippingAddress diff --git a/src/main/java/mobi/appcent/medusa/store/model/AnyOfStorePostCustomersCustomerReqBillingAddress.java b/src/main/java/mobi/appcent/medusa/store/model/response/AnyOfStorePostCustomersCustomerReqBillingAddress.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/AnyOfStorePostCustomersCustomerReqBillingAddress.java rename to src/main/java/mobi/appcent/medusa/store/model/response/AnyOfStorePostCustomersCustomerReqBillingAddress.java index ea7d061..b0b80b8 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/AnyOfStorePostCustomersCustomerReqBillingAddress.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/AnyOfStorePostCustomersCustomerReqBillingAddress.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; /** * AnyOfStorePostCustomersCustomerReqBillingAddress diff --git a/src/main/java/mobi/appcent/medusa/store/model/BatchJob.java b/src/main/java/mobi/appcent/medusa/store/model/response/BatchJob.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/BatchJob.java rename to src/main/java/mobi/appcent/medusa/store/model/response/BatchJob.java index 9877235..b5b9a6b 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/BatchJob.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/BatchJob.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/CanceledAt.java b/src/main/java/mobi/appcent/medusa/store/model/response/CanceledAt.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/CanceledAt.java rename to src/main/java/mobi/appcent/medusa/store/model/response/CanceledAt.java index fdfa392..77ce898 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/CanceledAt.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/CanceledAt.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/Cart.java b/src/main/java/mobi/appcent/medusa/store/model/response/Cart.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Cart.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Cart.java index 6fd3ad8..0d717a8 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Cart.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Cart.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ClaimImage.java b/src/main/java/mobi/appcent/medusa/store/model/response/ClaimImage.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ClaimImage.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ClaimImage.java index c840f34..f3f4cb7 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ClaimImage.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ClaimImage.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ClaimItem.java b/src/main/java/mobi/appcent/medusa/store/model/response/ClaimItem.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ClaimItem.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ClaimItem.java index 5752b43..119a694 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ClaimItem.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ClaimItem.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ClaimOrder.java b/src/main/java/mobi/appcent/medusa/store/model/response/ClaimOrder.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ClaimOrder.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ClaimOrder.java index 0a00fae..f709239 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ClaimOrder.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ClaimOrder.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ClaimTag.java b/src/main/java/mobi/appcent/medusa/store/model/response/ClaimTag.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ClaimTag.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ClaimTag.java index e885862..27f0673 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ClaimTag.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ClaimTag.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/Country.java b/src/main/java/mobi/appcent/medusa/store/model/response/Country.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Country.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Country.java index 8944f22..7da416a 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Country.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Country.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/CreateStockLocationInput.java b/src/main/java/mobi/appcent/medusa/store/model/response/CreateStockLocationInput.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/CreateStockLocationInput.java rename to src/main/java/mobi/appcent/medusa/store/model/response/CreateStockLocationInput.java index 773b08d..40f65d9 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/CreateStockLocationInput.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/CreateStockLocationInput.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/CreatedAt.java b/src/main/java/mobi/appcent/medusa/store/model/response/CreatedAt.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/CreatedAt.java rename to src/main/java/mobi/appcent/medusa/store/model/response/CreatedAt.java index 2886760..b3ec9d1 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/CreatedAt.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/CreatedAt.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/CreatedAt1.java b/src/main/java/mobi/appcent/medusa/store/model/response/CreatedAt1.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/CreatedAt1.java rename to src/main/java/mobi/appcent/medusa/store/model/response/CreatedAt1.java index 909dcf8..d021eda 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/CreatedAt1.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/CreatedAt1.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/CreatedAt2.java b/src/main/java/mobi/appcent/medusa/store/model/response/CreatedAt2.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/CreatedAt2.java rename to src/main/java/mobi/appcent/medusa/store/model/response/CreatedAt2.java index fc6bbb9..9debeaf 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/CreatedAt2.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/CreatedAt2.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/CreatedAt3.java b/src/main/java/mobi/appcent/medusa/store/model/response/CreatedAt3.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/CreatedAt3.java rename to src/main/java/mobi/appcent/medusa/store/model/response/CreatedAt3.java index fe74b57..11d9314 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/CreatedAt3.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/CreatedAt3.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/CreatedAt4.java b/src/main/java/mobi/appcent/medusa/store/model/response/CreatedAt4.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/CreatedAt4.java rename to src/main/java/mobi/appcent/medusa/store/model/response/CreatedAt4.java index 6ba7316..b069533 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/CreatedAt4.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/CreatedAt4.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/CreatedAt5.java b/src/main/java/mobi/appcent/medusa/store/model/response/CreatedAt5.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/CreatedAt5.java rename to src/main/java/mobi/appcent/medusa/store/model/response/CreatedAt5.java index c5d562d..ccfcfee 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/CreatedAt5.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/CreatedAt5.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/Currency.java b/src/main/java/mobi/appcent/medusa/store/model/response/Currency.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Currency.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Currency.java index 0a9beb3..ecee9de 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Currency.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Currency.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/CustomShippingOption.java b/src/main/java/mobi/appcent/medusa/store/model/response/CustomShippingOption.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/CustomShippingOption.java rename to src/main/java/mobi/appcent/medusa/store/model/response/CustomShippingOption.java index 333f2ac..100a6bd 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/CustomShippingOption.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/CustomShippingOption.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/Customer.java b/src/main/java/mobi/appcent/medusa/store/model/response/Customer.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Customer.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Customer.java index 69f44c2..7d46cf8 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Customer.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Customer.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/CustomerGroup.java b/src/main/java/mobi/appcent/medusa/store/model/response/CustomerGroup.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/CustomerGroup.java rename to src/main/java/mobi/appcent/medusa/store/model/response/CustomerGroup.java index 7796a87..1c2c2ba 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/CustomerGroup.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/CustomerGroup.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/Discount.java b/src/main/java/mobi/appcent/medusa/store/model/response/Discount.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Discount.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Discount.java index 8e98ef5..62417b3 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Discount.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Discount.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/DiscountCondition.java b/src/main/java/mobi/appcent/medusa/store/model/response/DiscountCondition.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/DiscountCondition.java rename to src/main/java/mobi/appcent/medusa/store/model/response/DiscountCondition.java index 770abb4..710cd16 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/DiscountCondition.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/DiscountCondition.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/DiscountConditionCustomerGroup.java b/src/main/java/mobi/appcent/medusa/store/model/response/DiscountConditionCustomerGroup.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/DiscountConditionCustomerGroup.java rename to src/main/java/mobi/appcent/medusa/store/model/response/DiscountConditionCustomerGroup.java index 1bf906b..a93cbbf 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/DiscountConditionCustomerGroup.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/DiscountConditionCustomerGroup.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/DiscountConditionProduct.java b/src/main/java/mobi/appcent/medusa/store/model/response/DiscountConditionProduct.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/DiscountConditionProduct.java rename to src/main/java/mobi/appcent/medusa/store/model/response/DiscountConditionProduct.java index 7ef4e26..fcb0b5c 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/DiscountConditionProduct.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/DiscountConditionProduct.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/DiscountConditionProductCollection.java b/src/main/java/mobi/appcent/medusa/store/model/response/DiscountConditionProductCollection.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/DiscountConditionProductCollection.java rename to src/main/java/mobi/appcent/medusa/store/model/response/DiscountConditionProductCollection.java index cb98f3f..b02983c 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/DiscountConditionProductCollection.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/DiscountConditionProductCollection.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/DiscountConditionProductTag.java b/src/main/java/mobi/appcent/medusa/store/model/response/DiscountConditionProductTag.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/DiscountConditionProductTag.java rename to src/main/java/mobi/appcent/medusa/store/model/response/DiscountConditionProductTag.java index 4b29919..151ca98 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/DiscountConditionProductTag.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/DiscountConditionProductTag.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/DiscountConditionProductType.java b/src/main/java/mobi/appcent/medusa/store/model/response/DiscountConditionProductType.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/DiscountConditionProductType.java rename to src/main/java/mobi/appcent/medusa/store/model/response/DiscountConditionProductType.java index 8fd1805..4d3d52d 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/DiscountConditionProductType.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/DiscountConditionProductType.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/DiscountRule.java b/src/main/java/mobi/appcent/medusa/store/model/response/DiscountRule.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/DiscountRule.java rename to src/main/java/mobi/appcent/medusa/store/model/response/DiscountRule.java index 84f33e1..b59dc5c 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/DiscountRule.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/DiscountRule.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/DraftOrder.java b/src/main/java/mobi/appcent/medusa/store/model/response/DraftOrder.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/DraftOrder.java rename to src/main/java/mobi/appcent/medusa/store/model/response/DraftOrder.java index bea5a65..4419b18 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/DraftOrder.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/DraftOrder.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/Error.java b/src/main/java/mobi/appcent/medusa/store/model/response/Error.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Error.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Error.java index 21b9529..9427520 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Error.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Error.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/Fulfillment.java b/src/main/java/mobi/appcent/medusa/store/model/response/Fulfillment.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Fulfillment.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Fulfillment.java index c1aaa2d..01af19a 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Fulfillment.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Fulfillment.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/FulfillmentItem.java b/src/main/java/mobi/appcent/medusa/store/model/response/FulfillmentItem.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/FulfillmentItem.java rename to src/main/java/mobi/appcent/medusa/store/model/response/FulfillmentItem.java index 7460ad9..57067d4 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/FulfillmentItem.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/FulfillmentItem.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/FulfillmentProvider.java b/src/main/java/mobi/appcent/medusa/store/model/response/FulfillmentProvider.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/FulfillmentProvider.java rename to src/main/java/mobi/appcent/medusa/store/model/response/FulfillmentProvider.java index 94695bc..8eae1f4 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/FulfillmentProvider.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/FulfillmentProvider.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/GiftCard.java b/src/main/java/mobi/appcent/medusa/store/model/response/GiftCard.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/GiftCard.java rename to src/main/java/mobi/appcent/medusa/store/model/response/GiftCard.java index df45fba..e521d92 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/GiftCard.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/GiftCard.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/GiftCardTransaction.java b/src/main/java/mobi/appcent/medusa/store/model/response/GiftCardTransaction.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/GiftCardTransaction.java rename to src/main/java/mobi/appcent/medusa/store/model/response/GiftCardTransaction.java index 4ea749a..0eccd41 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/GiftCardTransaction.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/GiftCardTransaction.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/Id.java b/src/main/java/mobi/appcent/medusa/store/model/response/Id.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Id.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Id.java index e4819c9..b151a14 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Id.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Id.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; /** * Id diff --git a/src/main/java/mobi/appcent/medusa/store/model/IdempotencyKey.java b/src/main/java/mobi/appcent/medusa/store/model/response/IdempotencyKey.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/IdempotencyKey.java rename to src/main/java/mobi/appcent/medusa/store/model/response/IdempotencyKey.java index 0840978..d6e697a 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/IdempotencyKey.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/IdempotencyKey.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/Image.java b/src/main/java/mobi/appcent/medusa/store/model/response/Image.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Image.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Image.java index e41b529..bb6df56 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Image.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Image.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/InlineResponse200.java b/src/main/java/mobi/appcent/medusa/store/model/response/InlineResponse200.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/InlineResponse200.java rename to src/main/java/mobi/appcent/medusa/store/model/response/InlineResponse200.java index 68afb94..2b03f6c 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/InlineResponse200.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/InlineResponse200.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/InlineResponse400.java b/src/main/java/mobi/appcent/medusa/store/model/response/InlineResponse400.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/InlineResponse400.java rename to src/main/java/mobi/appcent/medusa/store/model/response/InlineResponse400.java index ee8609e..f46bc08 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/InlineResponse400.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/InlineResponse400.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; /** * InlineResponse400 diff --git a/src/main/java/mobi/appcent/medusa/store/model/InlineResponse422.java b/src/main/java/mobi/appcent/medusa/store/model/response/InlineResponse422.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/InlineResponse422.java rename to src/main/java/mobi/appcent/medusa/store/model/response/InlineResponse422.java index 45902c5..6ff3b3e 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/InlineResponse422.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/InlineResponse422.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/InventoryItemDTO.java b/src/main/java/mobi/appcent/medusa/store/model/response/InventoryItemDTO.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/InventoryItemDTO.java rename to src/main/java/mobi/appcent/medusa/store/model/response/InventoryItemDTO.java index 55a9b9b..9670fa2 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/InventoryItemDTO.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/InventoryItemDTO.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/InventoryLevelDTO.java b/src/main/java/mobi/appcent/medusa/store/model/response/InventoryLevelDTO.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/InventoryLevelDTO.java rename to src/main/java/mobi/appcent/medusa/store/model/response/InventoryLevelDTO.java index 6ad284f..30c81c7 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/InventoryLevelDTO.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/InventoryLevelDTO.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/InventoryQuantity.java b/src/main/java/mobi/appcent/medusa/store/model/response/InventoryQuantity.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/InventoryQuantity.java rename to src/main/java/mobi/appcent/medusa/store/model/response/InventoryQuantity.java index 1288111..2dacd36 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/InventoryQuantity.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/InventoryQuantity.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; /** * InventoryQuantity diff --git a/src/main/java/mobi/appcent/medusa/store/model/Invite.java b/src/main/java/mobi/appcent/medusa/store/model/response/Invite.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Invite.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Invite.java index 070dd8d..d75110f 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Invite.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Invite.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/LineItem.java b/src/main/java/mobi/appcent/medusa/store/model/response/LineItem.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/LineItem.java rename to src/main/java/mobi/appcent/medusa/store/model/response/LineItem.java index 590580d..6bda5c8 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/LineItem.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/LineItem.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/LineItemAdjustment.java b/src/main/java/mobi/appcent/medusa/store/model/response/LineItemAdjustment.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/LineItemAdjustment.java rename to src/main/java/mobi/appcent/medusa/store/model/response/LineItemAdjustment.java index 77bb33f..10f3e75 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/LineItemAdjustment.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/LineItemAdjustment.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/LineItemTaxLine.java b/src/main/java/mobi/appcent/medusa/store/model/response/LineItemTaxLine.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/LineItemTaxLine.java rename to src/main/java/mobi/appcent/medusa/store/model/response/LineItemTaxLine.java index 594b65a..ee998cc 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/LineItemTaxLine.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/LineItemTaxLine.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ModelReturn.java b/src/main/java/mobi/appcent/medusa/store/model/response/ModelReturn.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ModelReturn.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ModelReturn.java index cbadc8c..903af4f 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ModelReturn.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ModelReturn.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/MoneyAmount.java b/src/main/java/mobi/appcent/medusa/store/model/response/MoneyAmount.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/MoneyAmount.java rename to src/main/java/mobi/appcent/medusa/store/model/response/MoneyAmount.java index 5c11b06..319c3e6 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/MoneyAmount.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/MoneyAmount.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/MultipleErrors.java b/src/main/java/mobi/appcent/medusa/store/model/response/MultipleErrors.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/MultipleErrors.java rename to src/main/java/mobi/appcent/medusa/store/model/response/MultipleErrors.java index e0fc5b0..1d5a56b 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/MultipleErrors.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/MultipleErrors.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/Note.java b/src/main/java/mobi/appcent/medusa/store/model/response/Note.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Note.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Note.java index ae3ff3e..f9aaa1b 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Note.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Note.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/Notification.java b/src/main/java/mobi/appcent/medusa/store/model/response/Notification.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Notification.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Notification.java index 24853b2..2f6210e 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Notification.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Notification.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/NotificationProvider.java b/src/main/java/mobi/appcent/medusa/store/model/response/NotificationProvider.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/NotificationProvider.java rename to src/main/java/mobi/appcent/medusa/store/model/response/NotificationProvider.java index 5ac0ebb..9861432 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/NotificationProvider.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/NotificationProvider.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/OAuth.java b/src/main/java/mobi/appcent/medusa/store/model/response/OAuth.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/OAuth.java rename to src/main/java/mobi/appcent/medusa/store/model/response/OAuth.java index 40a4a21..4741558 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/OAuth.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/OAuth.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/OneOfStoreCompleteCartResData.java b/src/main/java/mobi/appcent/medusa/store/model/response/OneOfStoreCompleteCartResData.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/OneOfStoreCompleteCartResData.java rename to src/main/java/mobi/appcent/medusa/store/model/response/OneOfStoreCompleteCartResData.java index 3cbff27..99754dc 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/OneOfStoreCompleteCartResData.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/OneOfStoreCompleteCartResData.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; /** * OneOfStoreCompleteCartResData diff --git a/src/main/java/mobi/appcent/medusa/store/model/Order.java b/src/main/java/mobi/appcent/medusa/store/model/response/Order.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Order.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Order.java index 35e0b87..8ba01f3 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Order.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Order.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/OrderEdit.java b/src/main/java/mobi/appcent/medusa/store/model/response/OrderEdit.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/OrderEdit.java rename to src/main/java/mobi/appcent/medusa/store/model/response/OrderEdit.java index 2d5d1e0..da3536c 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/OrderEdit.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/OrderEdit.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/OrderItemChange.java b/src/main/java/mobi/appcent/medusa/store/model/response/OrderItemChange.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/OrderItemChange.java rename to src/main/java/mobi/appcent/medusa/store/model/response/OrderItemChange.java index a40a139..8c7835c 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/OrderItemChange.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/OrderItemChange.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/Payment.java b/src/main/java/mobi/appcent/medusa/store/model/response/Payment.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Payment.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Payment.java index 60b6d41..d955920 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Payment.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Payment.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/PaymentCollection.java b/src/main/java/mobi/appcent/medusa/store/model/response/PaymentCollection.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/PaymentCollection.java rename to src/main/java/mobi/appcent/medusa/store/model/response/PaymentCollection.java index f39c935..91a9037 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/PaymentCollection.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/PaymentCollection.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/PaymentProvider.java b/src/main/java/mobi/appcent/medusa/store/model/response/PaymentProvider.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/PaymentProvider.java rename to src/main/java/mobi/appcent/medusa/store/model/response/PaymentProvider.java index 98c31c6..6c376a7 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/PaymentProvider.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/PaymentProvider.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/PaymentSession.java b/src/main/java/mobi/appcent/medusa/store/model/response/PaymentSession.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/PaymentSession.java rename to src/main/java/mobi/appcent/medusa/store/model/response/PaymentSession.java index 41848ba..0f793f8 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/PaymentSession.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/PaymentSession.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/PriceList.java b/src/main/java/mobi/appcent/medusa/store/model/response/PriceList.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/PriceList.java rename to src/main/java/mobi/appcent/medusa/store/model/response/PriceList.java index 6ed809b..9965961 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/PriceList.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/PriceList.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/PricedProduct.java b/src/main/java/mobi/appcent/medusa/store/model/response/PricedProduct.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/PricedProduct.java rename to src/main/java/mobi/appcent/medusa/store/model/response/PricedProduct.java index bafa3c2..75a0596 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/PricedProduct.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/PricedProduct.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/PricedVariant.java b/src/main/java/mobi/appcent/medusa/store/model/response/PricedVariant.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/PricedVariant.java rename to src/main/java/mobi/appcent/medusa/store/model/response/PricedVariant.java index bdfc1a0..c017a41 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/PricedVariant.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/PricedVariant.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/PricedVariantTaxRates.java b/src/main/java/mobi/appcent/medusa/store/model/response/PricedVariantTaxRates.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/PricedVariantTaxRates.java rename to src/main/java/mobi/appcent/medusa/store/model/response/PricedVariantTaxRates.java index ef274d6..3ff1eec 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/PricedVariantTaxRates.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/PricedVariantTaxRates.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/Product.java b/src/main/java/mobi/appcent/medusa/store/model/response/Product.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Product.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Product.java index 53eff87..d7d8c41 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Product.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Product.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ProductCategory.java b/src/main/java/mobi/appcent/medusa/store/model/response/ProductCategory.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ProductCategory.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ProductCategory.java index add2b7f..4c27a0f 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ProductCategory.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ProductCategory.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ProductCollection.java b/src/main/java/mobi/appcent/medusa/store/model/response/ProductCollection.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ProductCollection.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ProductCollection.java index 951048e..82e3ffa 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ProductCollection.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ProductCollection.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ProductOption.java b/src/main/java/mobi/appcent/medusa/store/model/response/ProductOption.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ProductOption.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ProductOption.java index 7e63759..2d1209d 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ProductOption.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ProductOption.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ProductOptionValue.java b/src/main/java/mobi/appcent/medusa/store/model/response/ProductOptionValue.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ProductOptionValue.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ProductOptionValue.java index 1ff1826..0893188 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ProductOptionValue.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ProductOptionValue.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ProductTag.java b/src/main/java/mobi/appcent/medusa/store/model/response/ProductTag.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ProductTag.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ProductTag.java index d101983..e53b25d 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ProductTag.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ProductTag.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ProductTaxRate.java b/src/main/java/mobi/appcent/medusa/store/model/response/ProductTaxRate.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ProductTaxRate.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ProductTaxRate.java index c920102..1b3c989 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ProductTaxRate.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ProductTaxRate.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ProductType.java b/src/main/java/mobi/appcent/medusa/store/model/response/ProductType.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ProductType.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ProductType.java index d039fac..94e9998 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ProductType.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ProductType.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ProductTypeTaxRate.java b/src/main/java/mobi/appcent/medusa/store/model/response/ProductTypeTaxRate.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ProductTypeTaxRate.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ProductTypeTaxRate.java index f17c5aa..066df4d 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ProductTypeTaxRate.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ProductTypeTaxRate.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ProductVariant.java b/src/main/java/mobi/appcent/medusa/store/model/response/ProductVariant.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ProductVariant.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ProductVariant.java index 0a9ef6c..804c653 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ProductVariant.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ProductVariant.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ProductVariantInventoryItem.java b/src/main/java/mobi/appcent/medusa/store/model/response/ProductVariantInventoryItem.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ProductVariantInventoryItem.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ProductVariantInventoryItem.java index 22d0e68..7945892 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ProductVariantInventoryItem.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ProductVariantInventoryItem.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/PublishableApiKey.java b/src/main/java/mobi/appcent/medusa/store/model/response/PublishableApiKey.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/PublishableApiKey.java rename to src/main/java/mobi/appcent/medusa/store/model/response/PublishableApiKey.java index 6f1e562..fc96ed8 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/PublishableApiKey.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/PublishableApiKey.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/PublishableApiKeySalesChannel.java b/src/main/java/mobi/appcent/medusa/store/model/response/PublishableApiKeySalesChannel.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/PublishableApiKeySalesChannel.java rename to src/main/java/mobi/appcent/medusa/store/model/response/PublishableApiKeySalesChannel.java index fbdadc4..68de831 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/PublishableApiKeySalesChannel.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/PublishableApiKeySalesChannel.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/Refund.java b/src/main/java/mobi/appcent/medusa/store/model/response/Refund.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Refund.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Refund.java index e8b2677..5749fc6 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Refund.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Refund.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/Region.java b/src/main/java/mobi/appcent/medusa/store/model/response/Region.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Region.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Region.java index 0c5368f..ffd2c69 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Region.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Region.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ReservationItemDTO.java b/src/main/java/mobi/appcent/medusa/store/model/response/ReservationItemDTO.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ReservationItemDTO.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ReservationItemDTO.java index 2a822cd..7699980 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ReservationItemDTO.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ReservationItemDTO.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ReturnItem.java b/src/main/java/mobi/appcent/medusa/store/model/response/ReturnItem.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ReturnItem.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ReturnItem.java index 0ac74ec..8d27856 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ReturnItem.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ReturnItem.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ReturnReason.java b/src/main/java/mobi/appcent/medusa/store/model/response/ReturnReason.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ReturnReason.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ReturnReason.java index 34a5a9e..6cae626 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ReturnReason.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ReturnReason.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/SalesChannel.java b/src/main/java/mobi/appcent/medusa/store/model/response/SalesChannel.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/SalesChannel.java rename to src/main/java/mobi/appcent/medusa/store/model/response/SalesChannel.java index 9acc864..b74e709 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/SalesChannel.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/SalesChannel.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/SalesChannelLocation.java b/src/main/java/mobi/appcent/medusa/store/model/response/SalesChannelLocation.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/SalesChannelLocation.java rename to src/main/java/mobi/appcent/medusa/store/model/response/SalesChannelLocation.java index 4bae7a4..8ca85f0 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/SalesChannelLocation.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/SalesChannelLocation.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ShippingAddress.java b/src/main/java/mobi/appcent/medusa/store/model/response/ShippingAddress.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ShippingAddress.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ShippingAddress.java index e7ed3ab..85677a1 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ShippingAddress.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ShippingAddress.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ShippingMethod.java b/src/main/java/mobi/appcent/medusa/store/model/response/ShippingMethod.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ShippingMethod.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ShippingMethod.java index 9a257ff..160bbd9 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ShippingMethod.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ShippingMethod.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ShippingMethodTaxLine.java b/src/main/java/mobi/appcent/medusa/store/model/response/ShippingMethodTaxLine.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ShippingMethodTaxLine.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ShippingMethodTaxLine.java index 39769bc..9ee998a 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ShippingMethodTaxLine.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ShippingMethodTaxLine.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ShippingOption.java b/src/main/java/mobi/appcent/medusa/store/model/response/ShippingOption.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ShippingOption.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ShippingOption.java index 48441db..d374169 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ShippingOption.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ShippingOption.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ShippingOptionRequirement.java b/src/main/java/mobi/appcent/medusa/store/model/response/ShippingOptionRequirement.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ShippingOptionRequirement.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ShippingOptionRequirement.java index 01d4c54..ec73797 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ShippingOptionRequirement.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ShippingOptionRequirement.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ShippingProfile.java b/src/main/java/mobi/appcent/medusa/store/model/response/ShippingProfile.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ShippingProfile.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ShippingProfile.java index 1150660..1e9b783 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ShippingProfile.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ShippingProfile.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/ShippingTaxRate.java b/src/main/java/mobi/appcent/medusa/store/model/response/ShippingTaxRate.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/ShippingTaxRate.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ShippingTaxRate.java index 73df89a..948fa27 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/ShippingTaxRate.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ShippingTaxRate.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StagedJob.java b/src/main/java/mobi/appcent/medusa/store/model/response/StagedJob.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StagedJob.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StagedJob.java index f904312..5a6a67b 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StagedJob.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StagedJob.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StockLocationAddressDTO.java b/src/main/java/mobi/appcent/medusa/store/model/response/StockLocationAddressDTO.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StockLocationAddressDTO.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StockLocationAddressDTO.java index b3685b2..645ef3d 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StockLocationAddressDTO.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StockLocationAddressDTO.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StockLocationAddressInput.java b/src/main/java/mobi/appcent/medusa/store/model/response/StockLocationAddressInput.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StockLocationAddressInput.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StockLocationAddressInput.java index 6a76df2..58cc4d4 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StockLocationAddressInput.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StockLocationAddressInput.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StockLocationDTO.java b/src/main/java/mobi/appcent/medusa/store/model/response/StockLocationDTO.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StockLocationDTO.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StockLocationDTO.java index db656c3..d3a98e8 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StockLocationDTO.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StockLocationDTO.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/Store.java b/src/main/java/mobi/appcent/medusa/store/model/response/Store.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Store.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Store.java index 12e8c58..ec4f22e 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Store.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Store.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreAuthRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreAuthRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreAuthRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreAuthRes.java index 028eeb9..86a55c5 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreAuthRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreAuthRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreCartsRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreCartsRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreCartsRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreCartsRes.java index d4ac080..c0fbde7 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreCartsRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreCartsRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreCollectionsListRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreCollectionsListRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreCollectionsListRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreCollectionsListRes.java index c86e9b0..bee28ba 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreCollectionsListRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreCollectionsListRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreCollectionsRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreCollectionsRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreCollectionsRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreCollectionsRes.java index d5c0987..c9fc6b7 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreCollectionsRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreCollectionsRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreCompleteCartRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreCompleteCartRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreCompleteCartRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreCompleteCartRes.java index 0c00855..809b0e6 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreCompleteCartRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreCompleteCartRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreCustomersListOrdersRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreCustomersListOrdersRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreCustomersListOrdersRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreCustomersListOrdersRes.java index 9e4728a..854f05e 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreCustomersListOrdersRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreCustomersListOrdersRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreCustomersListPaymentMethodsRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreCustomersListPaymentMethodsRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreCustomersListPaymentMethodsRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreCustomersListPaymentMethodsRes.java index de821c5..5ef0fae 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreCustomersListPaymentMethodsRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreCustomersListPaymentMethodsRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreCustomersListPaymentMethodsResPaymentMethods.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreCustomersListPaymentMethodsResPaymentMethods.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreCustomersListPaymentMethodsResPaymentMethods.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreCustomersListPaymentMethodsResPaymentMethods.java index f6a8b24..8f79ab5 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreCustomersListPaymentMethodsResPaymentMethods.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreCustomersListPaymentMethodsResPaymentMethods.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreCustomersRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreCustomersRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreCustomersRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreCustomersRes.java index 70e2645..e56ba27 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreCustomersRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreCustomersRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreGetAuthEmailRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreGetAuthEmailRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreGetAuthEmailRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreGetAuthEmailRes.java index fc8cea1..0de60db 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreGetAuthEmailRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreGetAuthEmailRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreGetProductCategoriesCategoryRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreGetProductCategoriesCategoryRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreGetProductCategoriesCategoryRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreGetProductCategoriesCategoryRes.java index 5443790..281c2d3 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreGetProductCategoriesCategoryRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreGetProductCategoriesCategoryRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreGiftCardsRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreGiftCardsRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreGiftCardsRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreGiftCardsRes.java index 9475df0..41a4e0f 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreGiftCardsRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreGiftCardsRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreOrderEditsRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreOrderEditsRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreOrderEditsRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreOrderEditsRes.java index 2b340ba..0936755 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreOrderEditsRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreOrderEditsRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreOrdersRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreOrdersRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreOrdersRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreOrdersRes.java index e1ec522..508195f 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreOrdersRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreOrdersRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePaymentCollectionSessionsReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePaymentCollectionSessionsReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePaymentCollectionSessionsReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePaymentCollectionSessionsReq.java index 5c7409e..5fc4d6e 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePaymentCollectionSessionsReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePaymentCollectionSessionsReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePaymentCollectionsRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePaymentCollectionsRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePaymentCollectionsRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePaymentCollectionsRes.java index fe13e2f..8b22217 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePaymentCollectionsRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePaymentCollectionsRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePaymentCollectionsSessionRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePaymentCollectionsSessionRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePaymentCollectionsSessionRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePaymentCollectionsSessionRes.java index c6b8e39..e77d441 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePaymentCollectionsSessionRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePaymentCollectionsSessionRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostAuthReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostAuthReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostAuthReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostAuthReq.java index db2cdad..3a52172 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostAuthReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostAuthReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostCartReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartReq.java index 5ccb865..3ee8ab3 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartReqItems.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartReqItems.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostCartReqItems.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartReqItems.java index d9e9c6f..6745298 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartReqItems.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartReqItems.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartLineItemsItemReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartLineItemsItemReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartLineItemsItemReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartLineItemsItemReq.java index f4738d9..69ec433 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartLineItemsItemReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartLineItemsItemReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartLineItemsReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartLineItemsReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartLineItemsReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartLineItemsReq.java index 77f61fa..f790a99 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartLineItemsReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartLineItemsReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartPaymentSessionReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartPaymentSessionReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartPaymentSessionReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartPaymentSessionReq.java index d6c05d6..c910251 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartPaymentSessionReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartPaymentSessionReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartPaymentSessionUpdateReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartPaymentSessionUpdateReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartPaymentSessionUpdateReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartPaymentSessionUpdateReq.java index 4b6bb79..58a0668 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartPaymentSessionUpdateReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartPaymentSessionUpdateReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartReq.java index faf592b..2a85f08 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartReqDiscounts.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartReqDiscounts.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartReqDiscounts.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartReqDiscounts.java index 09bd458..42bc54c 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartReqDiscounts.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartReqDiscounts.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartReqGiftCards.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartReqGiftCards.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartReqGiftCards.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartReqGiftCards.java index ff3e1ff..ca9f213 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartReqGiftCards.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartReqGiftCards.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartShippingMethodReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartShippingMethodReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartShippingMethodReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartShippingMethodReq.java index 93bf21e..8638836 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostCartsCartShippingMethodReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCartsCartShippingMethodReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersCustomerAcceptClaimReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersCustomerAcceptClaimReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersCustomerAcceptClaimReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersCustomerAcceptClaimReq.java index 38c2881..77fe413 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersCustomerAcceptClaimReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersCustomerAcceptClaimReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersCustomerAddressesAddressReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersCustomerAddressesAddressReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersCustomerAddressesAddressReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersCustomerAddressesAddressReq.java index 6eb479d..df5e49b 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersCustomerAddressesAddressReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersCustomerAddressesAddressReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; /** * StorePostCustomersCustomerAddressesAddressReq diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersCustomerAddressesReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersCustomerAddressesReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersCustomerAddressesReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersCustomerAddressesReq.java index da10318..03dcf61 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersCustomerAddressesReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersCustomerAddressesReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersCustomerOrderClaimReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersCustomerOrderClaimReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersCustomerOrderClaimReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersCustomerOrderClaimReq.java index c310962..6029016 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersCustomerOrderClaimReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersCustomerOrderClaimReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersCustomerPasswordTokenReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersCustomerPasswordTokenReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersCustomerPasswordTokenReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersCustomerPasswordTokenReq.java index 1a5586c..a450962 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersCustomerPasswordTokenReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersCustomerPasswordTokenReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersCustomerReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersCustomerReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersCustomerReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersCustomerReq.java index bf1b1d7..39ead89 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersCustomerReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersCustomerReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersReq.java index ebda3c6..f7c5b90 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersResetPasswordReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersResetPasswordReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersResetPasswordReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersResetPasswordReq.java index ca3cc5b..3d44849 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostCustomersResetPasswordReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostCustomersResetPasswordReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostOrderEditsOrderEditDecline.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostOrderEditsOrderEditDecline.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostOrderEditsOrderEditDecline.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostOrderEditsOrderEditDecline.java index 6dba666..428e1e6 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostOrderEditsOrderEditDecline.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostOrderEditsOrderEditDecline.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostPaymentCollectionsBatchSessionsAuthorizeReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostPaymentCollectionsBatchSessionsAuthorizeReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostPaymentCollectionsBatchSessionsAuthorizeReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostPaymentCollectionsBatchSessionsAuthorizeReq.java index ebef6ae..8334cb7 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostPaymentCollectionsBatchSessionsAuthorizeReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostPaymentCollectionsBatchSessionsAuthorizeReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostPaymentCollectionsBatchSessionsReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostPaymentCollectionsBatchSessionsReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostPaymentCollectionsBatchSessionsReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostPaymentCollectionsBatchSessionsReq.java index 62a2d60..972f39f 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostPaymentCollectionsBatchSessionsReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostPaymentCollectionsBatchSessionsReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostPaymentCollectionsBatchSessionsReqSessions.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostPaymentCollectionsBatchSessionsReqSessions.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostPaymentCollectionsBatchSessionsReqSessions.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostPaymentCollectionsBatchSessionsReqSessions.java index dc8bad3..01889ff 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostPaymentCollectionsBatchSessionsReqSessions.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostPaymentCollectionsBatchSessionsReqSessions.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostReturnsReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostReturnsReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostReturnsReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostReturnsReq.java index 00d2a53..ef39b10 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostReturnsReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostReturnsReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostReturnsReqItems.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostReturnsReqItems.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostReturnsReqItems.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostReturnsReqItems.java index 2869af9..5b85d72 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostReturnsReqItems.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostReturnsReqItems.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostReturnsReqReturnShipping.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostReturnsReqReturnShipping.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostReturnsReqReturnShipping.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostReturnsReqReturnShipping.java index b56afad..ff77094 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostReturnsReqReturnShipping.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostReturnsReqReturnShipping.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostSearchRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostSearchRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostSearchRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostSearchRes.java index cfb1971..2866c7c 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostSearchRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostSearchRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostSwapsReq.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostSwapsReq.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostSwapsReq.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostSwapsReq.java index 3029a9a..6fae3c8 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostSwapsReq.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostSwapsReq.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostSwapsReqAdditionalItems.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostSwapsReqAdditionalItems.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostSwapsReqAdditionalItems.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostSwapsReqAdditionalItems.java index 07a6432..cf0f7f9 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostSwapsReqAdditionalItems.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostSwapsReqAdditionalItems.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StorePostSwapsReqReturnItems.java b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostSwapsReqReturnItems.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StorePostSwapsReqReturnItems.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StorePostSwapsReqReturnItems.java index dca7013..92c1423 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StorePostSwapsReqReturnItems.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StorePostSwapsReqReturnItems.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreProductCategoriesListRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreProductCategoriesListRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreProductCategoriesListRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreProductCategoriesListRes.java index 0b725dd..d90b43d 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreProductCategoriesListRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreProductCategoriesListRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreProductTypesListRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreProductTypesListRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreProductTypesListRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreProductTypesListRes.java index b45eeac..fafaf01 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreProductTypesListRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreProductTypesListRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreProductsListRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreProductsListRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreProductsListRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreProductsListRes.java index 854a128..27f3e49 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreProductsListRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreProductsListRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreProductsRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreProductsRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreProductsRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreProductsRes.java index 291b860..c062c10 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreProductsRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreProductsRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreRegionsListRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreRegionsListRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreRegionsListRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreRegionsListRes.java index 0c275e9..139a82a 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreRegionsListRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreRegionsListRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreRegionsRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreRegionsRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreRegionsRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreRegionsRes.java index 89419ef..25993f5 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreRegionsRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreRegionsRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreReturnReasonsListRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreReturnReasonsListRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreReturnReasonsListRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreReturnReasonsListRes.java index 98679d0..7443804 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreReturnReasonsListRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreReturnReasonsListRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreReturnReasonsRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreReturnReasonsRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreReturnReasonsRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreReturnReasonsRes.java index 4c72367..b3e0f44 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreReturnReasonsRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreReturnReasonsRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreReturnsRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreReturnsRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreReturnsRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreReturnsRes.java index 7ee0f29..5d8ba60 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreReturnsRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreReturnsRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreShippingOptionsListRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreShippingOptionsListRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreShippingOptionsListRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreShippingOptionsListRes.java index 0cc0a89..538a6f4 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreShippingOptionsListRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreShippingOptionsListRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreSwapsRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreSwapsRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreSwapsRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreSwapsRes.java index 6dac357..96c109c 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreSwapsRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreSwapsRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreVariantsListRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreVariantsListRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreVariantsListRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreVariantsListRes.java index 6f6f77f..b2270b6 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreVariantsListRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreVariantsListRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/StoreVariantsRes.java b/src/main/java/mobi/appcent/medusa/store/model/response/StoreVariantsRes.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/StoreVariantsRes.java rename to src/main/java/mobi/appcent/medusa/store/model/response/StoreVariantsRes.java index 295fe43..023ab3c 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/StoreVariantsRes.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/StoreVariantsRes.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/Swap.java b/src/main/java/mobi/appcent/medusa/store/model/response/Swap.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Swap.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Swap.java index 4753bb1..5526602 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Swap.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Swap.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/TaxLine.java b/src/main/java/mobi/appcent/medusa/store/model/response/TaxLine.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/TaxLine.java rename to src/main/java/mobi/appcent/medusa/store/model/response/TaxLine.java index 87301a9..4abdf2d 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/TaxLine.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/TaxLine.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/TaxProvider.java b/src/main/java/mobi/appcent/medusa/store/model/response/TaxProvider.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/TaxProvider.java rename to src/main/java/mobi/appcent/medusa/store/model/response/TaxProvider.java index 7995294..567bca8 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/TaxProvider.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/TaxProvider.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/TaxRate.java b/src/main/java/mobi/appcent/medusa/store/model/response/TaxRate.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/TaxRate.java rename to src/main/java/mobi/appcent/medusa/store/model/response/TaxRate.java index 563ae26..e82e950 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/TaxRate.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/TaxRate.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/Title.java b/src/main/java/mobi/appcent/medusa/store/model/response/Title.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/Title.java rename to src/main/java/mobi/appcent/medusa/store/model/response/Title.java index 470ed37..f615453 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/Title.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/Title.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; /** * Title diff --git a/src/main/java/mobi/appcent/medusa/store/model/TrackingLink.java b/src/main/java/mobi/appcent/medusa/store/model/response/TrackingLink.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/TrackingLink.java rename to src/main/java/mobi/appcent/medusa/store/model/response/TrackingLink.java index dfc77aa..51b286e 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/TrackingLink.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/TrackingLink.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/UpdateStockLocationInput.java b/src/main/java/mobi/appcent/medusa/store/model/response/UpdateStockLocationInput.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/UpdateStockLocationInput.java rename to src/main/java/mobi/appcent/medusa/store/model/response/UpdateStockLocationInput.java index e8bd751..a8f07e7 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/UpdateStockLocationInput.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/UpdateStockLocationInput.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/UpdatedAt.java b/src/main/java/mobi/appcent/medusa/store/model/response/UpdatedAt.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/UpdatedAt.java rename to src/main/java/mobi/appcent/medusa/store/model/response/UpdatedAt.java index 836a26f..641b208 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/UpdatedAt.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/UpdatedAt.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/UpdatedAt1.java b/src/main/java/mobi/appcent/medusa/store/model/response/UpdatedAt1.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/UpdatedAt1.java rename to src/main/java/mobi/appcent/medusa/store/model/response/UpdatedAt1.java index 7cbaba3..2b44847 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/UpdatedAt1.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/UpdatedAt1.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/UpdatedAt2.java b/src/main/java/mobi/appcent/medusa/store/model/response/UpdatedAt2.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/UpdatedAt2.java rename to src/main/java/mobi/appcent/medusa/store/model/response/UpdatedAt2.java index f8d5192..652aacb 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/UpdatedAt2.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/UpdatedAt2.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/UpdatedAt3.java b/src/main/java/mobi/appcent/medusa/store/model/response/UpdatedAt3.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/UpdatedAt3.java rename to src/main/java/mobi/appcent/medusa/store/model/response/UpdatedAt3.java index ec68062..58cbc47 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/UpdatedAt3.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/UpdatedAt3.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/UpdatedAt4.java b/src/main/java/mobi/appcent/medusa/store/model/response/UpdatedAt4.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/UpdatedAt4.java rename to src/main/java/mobi/appcent/medusa/store/model/response/UpdatedAt4.java index cf1c4b4..ae3a6e3 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/UpdatedAt4.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/UpdatedAt4.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/UpdatedAt5.java b/src/main/java/mobi/appcent/medusa/store/model/response/UpdatedAt5.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/UpdatedAt5.java rename to src/main/java/mobi/appcent/medusa/store/model/response/UpdatedAt5.java index 3260afe..f9b9ffc 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/UpdatedAt5.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/UpdatedAt5.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/main/java/mobi/appcent/medusa/store/model/User.java b/src/main/java/mobi/appcent/medusa/store/model/response/User.java similarity index 99% rename from src/main/java/mobi/appcent/medusa/store/model/User.java rename to src/main/java/mobi/appcent/medusa/store/model/response/User.java index 7fa160a..d667a7e 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/User.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/User.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package mobi.appcent.medusa.store.model; +package mobi.appcent.medusa.store.model.response; import java.util.Objects; diff --git a/src/test/java/mobi/appcent/medusa/store/api/AuthApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/AuthApiTest.java index c3d7ae8..f598069 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/AuthApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/AuthApiTest.java @@ -12,9 +12,9 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.model.StoreAuthRes; -import mobi.appcent.medusa.store.model.StoreGetAuthEmailRes; -import mobi.appcent.medusa.store.model.StorePostAuthReq; +import mobi.appcent.medusa.store.model.response.StoreAuthRes; +import mobi.appcent.medusa.store.model.response.StoreGetAuthEmailRes; +import mobi.appcent.medusa.store.model.response.StorePostAuthReq; import org.junit.Test; import org.junit.Ignore; @@ -51,7 +51,7 @@ public void deleteAuthTest() throws Exception { */ @Test public void getAuthTest() throws Exception { - StoreAuthRes response = api.getAuth(); + StoreAuthRes response = api.getAuth().execute().getData(); // TODO: test validations } @@ -66,7 +66,7 @@ public void getAuthTest() throws Exception { @Test public void getAuthEmailTest() throws Exception { String email = null; - StoreGetAuthEmailRes response = api.getAuthEmail(email); + StoreGetAuthEmailRes response = api.getAuthEmail().email(email).execute().getData(); // TODO: test validations } @@ -80,9 +80,6 @@ public void getAuthEmailTest() throws Exception { */ @Test public void postAuthTest() throws Exception { - StorePostAuthReq body = null; - StoreAuthRes response = api.postAuth(body); - - // TODO: test validations + StoreAuthRes response = api.postAuth().email("").password("").execute().getData(); } } diff --git a/src/test/java/mobi/appcent/medusa/store/api/CartApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/CartApiTest.java index ca72e68..68f5603 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/CartApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/CartApiTest.java @@ -12,15 +12,15 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.model.StoreCartsRes; -import mobi.appcent.medusa.store.model.StoreCompleteCartRes; -import mobi.appcent.medusa.store.model.StorePostCartReq; -import mobi.appcent.medusa.store.model.StorePostCartsCartLineItemsItemReq; -import mobi.appcent.medusa.store.model.StorePostCartsCartLineItemsReq; -import mobi.appcent.medusa.store.model.StorePostCartsCartPaymentSessionReq; -import mobi.appcent.medusa.store.model.StorePostCartsCartPaymentSessionUpdateReq; -import mobi.appcent.medusa.store.model.StorePostCartsCartReq; -import mobi.appcent.medusa.store.model.StorePostCartsCartShippingMethodReq; +import mobi.appcent.medusa.store.model.response.StoreCartsRes; +import mobi.appcent.medusa.store.model.response.StoreCompleteCartRes; +import mobi.appcent.medusa.store.model.response.StorePostCartReq; +import mobi.appcent.medusa.store.model.response.StorePostCartsCartLineItemsItemReq; +import mobi.appcent.medusa.store.model.response.StorePostCartsCartLineItemsReq; +import mobi.appcent.medusa.store.model.response.StorePostCartsCartPaymentSessionReq; +import mobi.appcent.medusa.store.model.response.StorePostCartsCartPaymentSessionUpdateReq; +import mobi.appcent.medusa.store.model.response.StorePostCartsCartReq; +import mobi.appcent.medusa.store.model.response.StorePostCartsCartShippingMethodReq; import org.junit.Test; import org.junit.Ignore; diff --git a/src/test/java/mobi/appcent/medusa/store/api/CollectionApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/CollectionApiTest.java index c717988..94420cb 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/CollectionApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/CollectionApiTest.java @@ -12,10 +12,10 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.model.CreatedAt; -import mobi.appcent.medusa.store.model.StoreCollectionsListRes; -import mobi.appcent.medusa.store.model.StoreCollectionsRes; -import mobi.appcent.medusa.store.model.UpdatedAt; +import mobi.appcent.medusa.store.model.response.CreatedAt; +import mobi.appcent.medusa.store.model.response.StoreCollectionsListRes; +import mobi.appcent.medusa.store.model.response.StoreCollectionsRes; +import mobi.appcent.medusa.store.model.response.UpdatedAt; import org.junit.Test; import org.junit.Ignore; diff --git a/src/test/java/mobi/appcent/medusa/store/api/CustomerApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/CustomerApiTest.java index ee621ea..f32b3cd 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/CustomerApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/CustomerApiTest.java @@ -12,18 +12,18 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.model.CanceledAt; -import mobi.appcent.medusa.store.model.CreatedAt1; -import mobi.appcent.medusa.store.model.StoreCustomersListOrdersRes; -import mobi.appcent.medusa.store.model.StoreCustomersListPaymentMethodsRes; -import mobi.appcent.medusa.store.model.StoreCustomersRes; -import mobi.appcent.medusa.store.model.StorePostCustomersCustomerAddressesAddressReq; -import mobi.appcent.medusa.store.model.StorePostCustomersCustomerAddressesReq; -import mobi.appcent.medusa.store.model.StorePostCustomersCustomerPasswordTokenReq; -import mobi.appcent.medusa.store.model.StorePostCustomersCustomerReq; -import mobi.appcent.medusa.store.model.StorePostCustomersReq; -import mobi.appcent.medusa.store.model.StorePostCustomersResetPasswordReq; -import mobi.appcent.medusa.store.model.UpdatedAt1; +import mobi.appcent.medusa.store.model.response.CanceledAt; +import mobi.appcent.medusa.store.model.response.CreatedAt1; +import mobi.appcent.medusa.store.model.response.StoreCustomersListOrdersRes; +import mobi.appcent.medusa.store.model.response.StoreCustomersListPaymentMethodsRes; +import mobi.appcent.medusa.store.model.response.StoreCustomersRes; +import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerAddressesAddressReq; +import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerAddressesReq; +import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerPasswordTokenReq; +import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerReq; +import mobi.appcent.medusa.store.model.response.StorePostCustomersReq; +import mobi.appcent.medusa.store.model.response.StorePostCustomersResetPasswordReq; +import mobi.appcent.medusa.store.model.response.UpdatedAt1; import org.junit.Test; import org.junit.Ignore; diff --git a/src/test/java/mobi/appcent/medusa/store/api/GiftCardApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/GiftCardApiTest.java index 17b216d..050bb14 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/GiftCardApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/GiftCardApiTest.java @@ -12,7 +12,7 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.model.StoreGiftCardsRes; +import mobi.appcent.medusa.store.model.response.StoreGiftCardsRes; import org.junit.Test; import org.junit.Ignore; diff --git a/src/test/java/mobi/appcent/medusa/store/api/InviteApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/InviteApiTest.java index 8c43731..dd9e2a6 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/InviteApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/InviteApiTest.java @@ -12,7 +12,7 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.model.StorePostCustomersCustomerOrderClaimReq; +import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerOrderClaimReq; import org.junit.Test; import org.junit.Ignore; diff --git a/src/test/java/mobi/appcent/medusa/store/api/OrderApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/OrderApiTest.java index 284b57d..b7e9649 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/OrderApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/OrderApiTest.java @@ -14,9 +14,9 @@ import java.math.BigDecimal; -import mobi.appcent.medusa.store.model.ShippingAddress; -import mobi.appcent.medusa.store.model.StoreOrdersRes; -import mobi.appcent.medusa.store.model.StorePostCustomersCustomerAcceptClaimReq; +import mobi.appcent.medusa.store.model.response.ShippingAddress; +import mobi.appcent.medusa.store.model.response.StoreOrdersRes; +import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerAcceptClaimReq; import org.junit.Test; import org.junit.Ignore; diff --git a/src/test/java/mobi/appcent/medusa/store/api/OrderEditApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/OrderEditApiTest.java index 59a3e85..60561ed 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/OrderEditApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/OrderEditApiTest.java @@ -12,8 +12,8 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.model.StoreOrderEditsRes; -import mobi.appcent.medusa.store.model.StorePostOrderEditsOrderEditDecline; +import mobi.appcent.medusa.store.model.response.StoreOrderEditsRes; +import mobi.appcent.medusa.store.model.response.StorePostOrderEditsOrderEditDecline; import org.junit.Test; import org.junit.Ignore; diff --git a/src/test/java/mobi/appcent/medusa/store/api/PaymentCollectionApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/PaymentCollectionApiTest.java index cb564fa..5204e01 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/PaymentCollectionApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/PaymentCollectionApiTest.java @@ -12,11 +12,11 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.model.StorePaymentCollectionSessionsReq; -import mobi.appcent.medusa.store.model.StorePaymentCollectionsRes; -import mobi.appcent.medusa.store.model.StorePaymentCollectionsSessionRes; -import mobi.appcent.medusa.store.model.StorePostPaymentCollectionsBatchSessionsAuthorizeReq; -import mobi.appcent.medusa.store.model.StorePostPaymentCollectionsBatchSessionsReq; +import mobi.appcent.medusa.store.model.response.StorePaymentCollectionSessionsReq; +import mobi.appcent.medusa.store.model.response.StorePaymentCollectionsRes; +import mobi.appcent.medusa.store.model.response.StorePaymentCollectionsSessionRes; +import mobi.appcent.medusa.store.model.response.StorePostPaymentCollectionsBatchSessionsAuthorizeReq; +import mobi.appcent.medusa.store.model.response.StorePostPaymentCollectionsBatchSessionsReq; import org.junit.Test; import org.junit.Ignore; diff --git a/src/test/java/mobi/appcent/medusa/store/api/ProductApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/ProductApiTest.java index 9ba8885..73b6958 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/ProductApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/ProductApiTest.java @@ -12,12 +12,12 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.model.CreatedAt4; -import mobi.appcent.medusa.store.model.Id; -import mobi.appcent.medusa.store.model.StorePostSearchRes; -import mobi.appcent.medusa.store.model.StoreProductsListRes; -import mobi.appcent.medusa.store.model.StoreProductsRes; -import mobi.appcent.medusa.store.model.UpdatedAt4; +import mobi.appcent.medusa.store.model.response.CreatedAt4; +import mobi.appcent.medusa.store.model.response.Id; +import mobi.appcent.medusa.store.model.response.StorePostSearchRes; +import mobi.appcent.medusa.store.model.response.StoreProductsListRes; +import mobi.appcent.medusa.store.model.response.StoreProductsRes; +import mobi.appcent.medusa.store.model.response.UpdatedAt4; import org.junit.Test; import org.junit.Ignore; diff --git a/src/test/java/mobi/appcent/medusa/store/api/ProductCategoryApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/ProductCategoryApiTest.java index 7e0502c..3bf4bc3 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/ProductCategoryApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/ProductCategoryApiTest.java @@ -12,8 +12,8 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.model.StoreGetProductCategoriesCategoryRes; -import mobi.appcent.medusa.store.model.StoreProductCategoriesListRes; +import mobi.appcent.medusa.store.model.response.StoreGetProductCategoriesCategoryRes; +import mobi.appcent.medusa.store.model.response.StoreProductCategoriesListRes; import org.junit.Test; import org.junit.Ignore; diff --git a/src/test/java/mobi/appcent/medusa/store/api/ProductTagApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/ProductTagApiTest.java index 09711f6..7a9614c 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/ProductTagApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/ProductTagApiTest.java @@ -12,9 +12,9 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.model.CreatedAt2; -import mobi.appcent.medusa.store.model.InlineResponse200; -import mobi.appcent.medusa.store.model.UpdatedAt2; +import mobi.appcent.medusa.store.model.response.CreatedAt2; +import mobi.appcent.medusa.store.model.response.InlineResponse200; +import mobi.appcent.medusa.store.model.response.UpdatedAt2; import org.junit.Test; import org.junit.Ignore; diff --git a/src/test/java/mobi/appcent/medusa/store/api/ProductTypeApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/ProductTypeApiTest.java index 22934d3..e442ac5 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/ProductTypeApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/ProductTypeApiTest.java @@ -12,9 +12,9 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.model.CreatedAt3; -import mobi.appcent.medusa.store.model.StoreProductTypesListRes; -import mobi.appcent.medusa.store.model.UpdatedAt3; +import mobi.appcent.medusa.store.model.response.CreatedAt3; +import mobi.appcent.medusa.store.model.response.StoreProductTypesListRes; +import mobi.appcent.medusa.store.model.response.UpdatedAt3; import org.junit.Test; import org.junit.Ignore; diff --git a/src/test/java/mobi/appcent/medusa/store/api/ProductVariantApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/ProductVariantApiTest.java index 46022a3..db5a7b5 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/ProductVariantApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/ProductVariantApiTest.java @@ -14,10 +14,10 @@ import java.math.BigDecimal; -import mobi.appcent.medusa.store.model.InventoryQuantity; -import mobi.appcent.medusa.store.model.StoreVariantsListRes; -import mobi.appcent.medusa.store.model.StoreVariantsRes; -import mobi.appcent.medusa.store.model.Title; +import mobi.appcent.medusa.store.model.response.InventoryQuantity; +import mobi.appcent.medusa.store.model.response.StoreVariantsListRes; +import mobi.appcent.medusa.store.model.response.StoreVariantsRes; +import mobi.appcent.medusa.store.model.response.Title; import org.junit.Test; import org.junit.Ignore; diff --git a/src/test/java/mobi/appcent/medusa/store/api/RegionApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/RegionApiTest.java index 2577a61..1f2c5f2 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/RegionApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/RegionApiTest.java @@ -12,10 +12,10 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.model.CreatedAt5; -import mobi.appcent.medusa.store.model.StoreRegionsListRes; -import mobi.appcent.medusa.store.model.StoreRegionsRes; -import mobi.appcent.medusa.store.model.UpdatedAt5; +import mobi.appcent.medusa.store.model.response.CreatedAt5; +import mobi.appcent.medusa.store.model.response.StoreRegionsListRes; +import mobi.appcent.medusa.store.model.response.StoreRegionsRes; +import mobi.appcent.medusa.store.model.response.UpdatedAt5; import org.junit.Test; import org.junit.Ignore; diff --git a/src/test/java/mobi/appcent/medusa/store/api/ReturnApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/ReturnApiTest.java index a001bd2..ca1df47 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/ReturnApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/ReturnApiTest.java @@ -12,8 +12,8 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.model.StorePostReturnsReq; -import mobi.appcent.medusa.store.model.StoreReturnsRes; +import mobi.appcent.medusa.store.model.response.StorePostReturnsReq; +import mobi.appcent.medusa.store.model.response.StoreReturnsRes; import org.junit.Test; import org.junit.Ignore; diff --git a/src/test/java/mobi/appcent/medusa/store/api/ReturnReasonApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/ReturnReasonApiTest.java index 1ca44bd..b65eca5 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/ReturnReasonApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/ReturnReasonApiTest.java @@ -12,8 +12,8 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.model.StoreReturnReasonsListRes; -import mobi.appcent.medusa.store.model.StoreReturnReasonsRes; +import mobi.appcent.medusa.store.model.response.StoreReturnReasonsListRes; +import mobi.appcent.medusa.store.model.response.StoreReturnReasonsRes; import org.junit.Test; import org.junit.Ignore; diff --git a/src/test/java/mobi/appcent/medusa/store/api/ShippingOptionApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/ShippingOptionApiTest.java index dc14213..3df9096 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/ShippingOptionApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/ShippingOptionApiTest.java @@ -12,7 +12,7 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.model.StoreShippingOptionsListRes; +import mobi.appcent.medusa.store.model.response.StoreShippingOptionsListRes; import org.junit.Test; import org.junit.Ignore; diff --git a/src/test/java/mobi/appcent/medusa/store/api/SwapApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/SwapApiTest.java index ff80fd6..5280390 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/SwapApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/SwapApiTest.java @@ -12,8 +12,8 @@ package mobi.appcent.medusa.store.api; -import mobi.appcent.medusa.store.model.StorePostSwapsReq; -import mobi.appcent.medusa.store.model.StoreSwapsRes; +import mobi.appcent.medusa.store.model.response.StorePostSwapsReq; +import mobi.appcent.medusa.store.model.response.StoreSwapsRes; import org.junit.Test; import org.junit.Ignore; From b0943a3c62a40414b700778c8aaf56ce4b30c408 Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Wed, 8 Mar 2023 22:53:12 +0300 Subject: [PATCH 02/32] feat(cart-api): Refactor carts api (#2) --- .../appcent/medusa/store/api/CartApi.java | 1866 +---------------- .../request/cart/AddLineItemRequest.java | 63 + .../cart/AddShippingMethodRequest.java | 63 + .../cart/CalculateCartTaxesRequest.java | 56 + .../request/cart/CompleteCartRequest.java | 56 + .../model/request/cart/CreateCartRequest.java | 61 + .../cart/CreatePaymentSessionsRequest.java | 52 + .../request/cart/DeleteLineItemRequest.java | 54 + .../cart/DeletePaymentSessionRequest.java | 55 + .../model/request/cart/GetCartRequest.java | 56 + .../cart/RefreshPaymentSessionRequest.java | 56 + .../request/cart/RemoveDiscountRequest.java | 58 + .../cart/SelectPaymentSessionRequest.java | 60 + .../model/request/cart/UpdateCartRequest.java | 63 + .../request/cart/UpdateLineItemRequest.java | 65 + .../cart/UpdatePaymentSessionRequest.java | 62 + .../appcent/medusa/store/api/CartApiTest.java | 34 +- 17 files changed, 937 insertions(+), 1843 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/cart/AddLineItemRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/cart/AddShippingMethodRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/cart/CalculateCartTaxesRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/cart/CompleteCartRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/cart/CreateCartRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/cart/CreatePaymentSessionsRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/cart/DeleteLineItemRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/cart/DeletePaymentSessionRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/cart/GetCartRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/cart/RefreshPaymentSessionRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/cart/RemoveDiscountRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/cart/SelectPaymentSessionRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdateCartRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdateLineItemRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdatePaymentSessionRequest.java diff --git a/src/main/java/mobi/appcent/medusa/store/api/CartApi.java b/src/main/java/mobi/appcent/medusa/store/api/CartApi.java index f63de4a..314b1c9 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/CartApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/CartApi.java @@ -15,26 +15,8 @@ import mobi.appcent.medusa.store.*; import mobi.appcent.medusa.store.MedusaSdkClient; -import com.google.gson.reflect.TypeToken; -import java.io.IOException; - - -import mobi.appcent.medusa.store.model.response.StoreCartsRes; -import mobi.appcent.medusa.store.model.response.StoreCompleteCartRes; -import mobi.appcent.medusa.store.model.response.StorePostCartReq; -import mobi.appcent.medusa.store.model.response.StorePostCartsCartLineItemsItemReq; -import mobi.appcent.medusa.store.model.response.StorePostCartsCartLineItemsReq; -import mobi.appcent.medusa.store.model.response.StorePostCartsCartPaymentSessionReq; -import mobi.appcent.medusa.store.model.response.StorePostCartsCartPaymentSessionUpdateReq; -import mobi.appcent.medusa.store.model.response.StorePostCartsCartReq; -import mobi.appcent.medusa.store.model.response.StorePostCartsCartShippingMethodReq; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import mobi.appcent.medusa.store.model.request.cart.*; public class CartApi extends BaseApi { private MedusaSdkClient medusaSdkClient; @@ -49,78 +31,6 @@ public MedusaSdkClient getApiClient() { public void setApiClient(MedusaSdkClient medusaSdkClient) { this.medusaSdkClient = medusaSdkClient; - } - - /** - * Build call for deleteCartsCartDiscountsDiscount - * @param id The id of the Cart. (required) - * @param code The unique Discount code. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteCartsCartDiscountsDiscountCall(String id, String code, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/carts/{id}/discounts/{code}" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())) - .replaceAll("\\{" + "code" + "\\}", medusaSdkClient.escapeString(code.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteCartsCartDiscountsDiscountValidateBeforeCall(String id, String code, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling deleteCartsCartDiscountsDiscount(Async)"); - } - // verify the required parameter 'code' is set - if (code == null) { - throw new ApiException("Missing the required parameter 'code' when calling deleteCartsCartDiscountsDiscount(Async)"); - } - - com.squareup.okhttp.Call call = deleteCartsCartDiscountsDiscountCall(id, code, progressListener, progressRequestListener); - return call; - - - - - } /** @@ -131,130 +41,8 @@ private com.squareup.okhttp.Call deleteCartsCartDiscountsDiscountValidateBeforeC * @return StoreCartsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCartsRes deleteCartsCartDiscountsDiscount(String id, String code) throws ApiException { - ApiResponse resp = deleteCartsCartDiscountsDiscountWithHttpInfo(id, code); - return resp.getData(); - } - - /** - * Remove Discount - * Removes a Discount from a Cart. - * @param id The id of the Cart. (required) - * @param code The unique Discount code. (required) - * @return ApiResponse<StoreCartsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteCartsCartDiscountsDiscountWithHttpInfo(String id, String code) throws ApiException { - com.squareup.okhttp.Call call = deleteCartsCartDiscountsDiscountValidateBeforeCall(id, code, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Remove Discount (asynchronously) - * Removes a Discount from a Cart. - * @param id The id of the Cart. (required) - * @param code The unique Discount code. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteCartsCartDiscountsDiscountAsync(String id, String code, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteCartsCartDiscountsDiscountValidateBeforeCall(id, code, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for deleteCartsCartLineItemsItem - * @param id The id of the Cart. (required) - * @param lineId The id of the Line Item. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteCartsCartLineItemsItemCall(String id, String lineId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/carts/{id}/line-items/{line_id}" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())) - .replaceAll("\\{" + "line_id" + "\\}", medusaSdkClient.escapeString(lineId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteCartsCartLineItemsItemValidateBeforeCall(String id, String lineId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling deleteCartsCartLineItemsItem(Async)"); - } - // verify the required parameter 'lineId' is set - if (lineId == null) { - throw new ApiException("Missing the required parameter 'lineId' when calling deleteCartsCartLineItemsItem(Async)"); - } - - com.squareup.okhttp.Call call = deleteCartsCartLineItemsItemCall(id, lineId, progressListener, progressRequestListener); - return call; - - - - - + public RemoveDiscountRequest removeDiscount(String id, String code) throws ApiException { + return new RemoveDiscountRequest(medusaSdkClient, id, code); } /** @@ -265,130 +53,8 @@ private com.squareup.okhttp.Call deleteCartsCartLineItemsItemValidateBeforeCall( * @return StoreCartsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCartsRes deleteCartsCartLineItemsItem(String id, String lineId) throws ApiException { - ApiResponse resp = deleteCartsCartLineItemsItemWithHttpInfo(id, lineId); - return resp.getData(); - } - - /** - * Delete a Line Item - * Removes a Line Item from a Cart. - * @param id The id of the Cart. (required) - * @param lineId The id of the Line Item. (required) - * @return ApiResponse<StoreCartsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteCartsCartLineItemsItemWithHttpInfo(String id, String lineId) throws ApiException { - com.squareup.okhttp.Call call = deleteCartsCartLineItemsItemValidateBeforeCall(id, lineId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Delete a Line Item (asynchronously) - * Removes a Line Item from a Cart. - * @param id The id of the Cart. (required) - * @param lineId The id of the Line Item. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteCartsCartLineItemsItemAsync(String id, String lineId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteCartsCartLineItemsItemValidateBeforeCall(id, lineId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for deleteCartsCartPaymentSessionsSession - * @param id The id of the Cart. (required) - * @param providerId The id of the Payment Provider used to create the Payment Session to be deleted. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteCartsCartPaymentSessionsSessionCall(String id, String providerId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/carts/{id}/payment-sessions/{provider_id}" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())) - .replaceAll("\\{" + "provider_id" + "\\}", medusaSdkClient.escapeString(providerId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteCartsCartPaymentSessionsSessionValidateBeforeCall(String id, String providerId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling deleteCartsCartPaymentSessionsSession(Async)"); - } - // verify the required parameter 'providerId' is set - if (providerId == null) { - throw new ApiException("Missing the required parameter 'providerId' when calling deleteCartsCartPaymentSessionsSession(Async)"); - } - - com.squareup.okhttp.Call call = deleteCartsCartPaymentSessionsSessionCall(id, providerId, progressListener, progressRequestListener); - return call; - - - - - + public DeleteLineItemRequest deleteLineItem(String id, String lineId) throws ApiException { + return new DeleteLineItemRequest(medusaSdkClient, id, lineId); } /** @@ -399,124 +65,8 @@ private com.squareup.okhttp.Call deleteCartsCartPaymentSessionsSessionValidateBe * @return StoreCartsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCartsRes deleteCartsCartPaymentSessionsSession(String id, String providerId) throws ApiException { - ApiResponse resp = deleteCartsCartPaymentSessionsSessionWithHttpInfo(id, providerId); - return resp.getData(); - } - - /** - * Delete a Payment Session - * Deletes a Payment Session on a Cart. May be useful if a payment has failed. - * @param id The id of the Cart. (required) - * @param providerId The id of the Payment Provider used to create the Payment Session to be deleted. (required) - * @return ApiResponse<StoreCartsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteCartsCartPaymentSessionsSessionWithHttpInfo(String id, String providerId) throws ApiException { - com.squareup.okhttp.Call call = deleteCartsCartPaymentSessionsSessionValidateBeforeCall(id, providerId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Delete a Payment Session (asynchronously) - * Deletes a Payment Session on a Cart. May be useful if a payment has failed. - * @param id The id of the Cart. (required) - * @param providerId The id of the Payment Provider used to create the Payment Session to be deleted. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteCartsCartPaymentSessionsSessionAsync(String id, String providerId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteCartsCartPaymentSessionsSessionValidateBeforeCall(id, providerId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getCartsCart - * @param id The id of the Cart. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getCartsCartCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/carts/{id}" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getCartsCartValidateBeforeCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling getCartsCart(Async)"); - } - - com.squareup.okhttp.Call call = getCartsCartCall(id, progressListener, progressRequestListener); - return call; - - - - - + public DeletePaymentSessionRequest deletePaymentSession(String id, String providerId) throws ApiException { + return new DeletePaymentSessionRequest(medusaSdkClient, id, providerId); } /** @@ -526,371 +76,31 @@ private com.squareup.okhttp.Call getCartsCartValidateBeforeCall(String id, final * @return StoreCartsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCartsRes getCartsCart(String id) throws ApiException { - ApiResponse resp = getCartsCartWithHttpInfo(id); - return resp.getData(); - } - - /** - * Get a Cart - * Retrieves a Cart. - * @param id The id of the Cart. (required) - * @return ApiResponse<StoreCartsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getCartsCartWithHttpInfo(String id) throws ApiException { - com.squareup.okhttp.Call call = getCartsCartValidateBeforeCall(id, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Get a Cart (asynchronously) - * Retrieves a Cart. - * @param id The id of the Cart. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getCartsCartAsync(String id, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getCartsCartValidateBeforeCall(id, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postCart - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postCartCall(StorePostCartReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/carts"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postCartValidateBeforeCall(StorePostCartReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = postCartCall(body, progressListener, progressRequestListener); - return call; - - - - - + public GetCartRequest getCart(String id) throws ApiException { + return new GetCartRequest(medusaSdkClient, id); } /** * Create a Cart * Creates a Cart within the given region and with the initial items. If no `region_id` is provided the cart will be associated with the first Region available. If no items are provided the cart will be empty after creation. If a user is logged in the cart's customer id and email will be set. - * @param body (optional) + * body (optional) * @return StoreCartsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCartsRes postCart(StorePostCartReq body) throws ApiException { - ApiResponse resp = postCartWithHttpInfo(body); - return resp.getData(); - } - - /** - * Create a Cart - * Creates a Cart within the given region and with the initial items. If no `region_id` is provided the cart will be associated with the first Region available. If no items are provided the cart will be empty after creation. If a user is logged in the cart's customer id and email will be set. - * @param body (optional) - * @return ApiResponse<StoreCartsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postCartWithHttpInfo(StorePostCartReq body) throws ApiException { - com.squareup.okhttp.Call call = postCartValidateBeforeCall(body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Create a Cart (asynchronously) - * Creates a Cart within the given region and with the initial items. If no `region_id` is provided the cart will be associated with the first Region available. If no items are provided the cart will be empty after creation. If a user is logged in the cart's customer id and email will be set. - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postCartAsync(StorePostCartReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postCartValidateBeforeCall(body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postCartsCart - * @param id The id of the Cart. (required) - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postCartsCartCall(String id, StorePostCartsCartReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/carts/{id}" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postCartsCartValidateBeforeCall(String id, StorePostCartsCartReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling postCartsCart(Async)"); - } - - com.squareup.okhttp.Call call = postCartsCartCall(id, body, progressListener, progressRequestListener); - return call; - - - - - + public CreateCartRequest createCart() throws ApiException { + return new CreateCartRequest(medusaSdkClient); } /** * Update a Cart * Updates a Cart. * @param id The id of the Cart. (required) - * @param body (optional) + * body (optional) * @return StoreCartsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCartsRes postCartsCart(String id, StorePostCartsCartReq body) throws ApiException { - ApiResponse resp = postCartsCartWithHttpInfo(id, body); - return resp.getData(); - } - - /** - * Update a Cart - * Updates a Cart. - * @param id The id of the Cart. (required) - * @param body (optional) - * @return ApiResponse<StoreCartsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postCartsCartWithHttpInfo(String id, StorePostCartsCartReq body) throws ApiException { - com.squareup.okhttp.Call call = postCartsCartValidateBeforeCall(id, body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Update a Cart (asynchronously) - * Updates a Cart. - * @param id The id of the Cart. (required) - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postCartsCartAsync(String id, StorePostCartsCartReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postCartsCartValidateBeforeCall(id, body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postCartsCartComplete - * @param id The Cart id. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postCartsCartCompleteCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/carts/{id}/complete" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postCartsCartCompleteValidateBeforeCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling postCartsCartComplete(Async)"); - } - - com.squareup.okhttp.Call call = postCartsCartCompleteCall(id, progressListener, progressRequestListener); - return call; - - - - - + public UpdateCartRequest updateCart(String id) throws ApiException { + return new UpdateCartRequest(medusaSdkClient, id); } /** @@ -900,258 +110,20 @@ private com.squareup.okhttp.Call postCartsCartCompleteValidateBeforeCall(String * @return StoreCompleteCartRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCompleteCartRes postCartsCartComplete(String id) throws ApiException { - ApiResponse resp = postCartsCartCompleteWithHttpInfo(id); - return resp.getData(); - } - - /** - * Complete a Cart - * Completes a cart. The following steps will be performed. Payment authorization is attempted and if more work is required, we simply return the cart for further updates. If payment is authorized and order is not yet created, we make sure to do so. The completion of a cart can be performed idempotently with a provided header `Idempotency-Key`. If not provided, we will generate one for the request. - * @param id The Cart id. (required) - * @return ApiResponse<StoreCompleteCartRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postCartsCartCompleteWithHttpInfo(String id) throws ApiException { - com.squareup.okhttp.Call call = postCartsCartCompleteValidateBeforeCall(id, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Complete a Cart (asynchronously) - * Completes a cart. The following steps will be performed. Payment authorization is attempted and if more work is required, we simply return the cart for further updates. If payment is authorized and order is not yet created, we make sure to do so. The completion of a cart can be performed idempotently with a provided header `Idempotency-Key`. If not provided, we will generate one for the request. - * @param id The Cart id. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postCartsCartCompleteAsync(String id, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postCartsCartCompleteValidateBeforeCall(id, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postCartsCartLineItems - * @param id The id of the Cart to add the Line Item to. (required) - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postCartsCartLineItemsCall(String id, StorePostCartsCartLineItemsReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/carts/{id}/line-items" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postCartsCartLineItemsValidateBeforeCall(String id, StorePostCartsCartLineItemsReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling postCartsCartLineItems(Async)"); - } - - com.squareup.okhttp.Call call = postCartsCartLineItemsCall(id, body, progressListener, progressRequestListener); - return call; - - - - - + public CompleteCartRequest completeCart(String id) throws ApiException { + return new CompleteCartRequest(medusaSdkClient, id); } /** * Add a Line Item * Generates a Line Item with a given Product Variant and adds it to the Cart * @param id The id of the Cart to add the Line Item to. (required) - * @param body (optional) + * body (optional) * @return StoreCartsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCartsRes postCartsCartLineItems(String id, StorePostCartsCartLineItemsReq body) throws ApiException { - ApiResponse resp = postCartsCartLineItemsWithHttpInfo(id, body); - return resp.getData(); - } - - /** - * Add a Line Item - * Generates a Line Item with a given Product Variant and adds it to the Cart - * @param id The id of the Cart to add the Line Item to. (required) - * @param body (optional) - * @return ApiResponse<StoreCartsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postCartsCartLineItemsWithHttpInfo(String id, StorePostCartsCartLineItemsReq body) throws ApiException { - com.squareup.okhttp.Call call = postCartsCartLineItemsValidateBeforeCall(id, body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Add a Line Item (asynchronously) - * Generates a Line Item with a given Product Variant and adds it to the Cart - * @param id The id of the Cart to add the Line Item to. (required) - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postCartsCartLineItemsAsync(String id, StorePostCartsCartLineItemsReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postCartsCartLineItemsValidateBeforeCall(id, body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postCartsCartLineItemsItem - * @param id The id of the Cart. (required) - * @param lineId The id of the Line Item. (required) - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postCartsCartLineItemsItemCall(String id, String lineId, StorePostCartsCartLineItemsItemReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/carts/{id}/line-items/{line_id}" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())) - .replaceAll("\\{" + "line_id" + "\\}", medusaSdkClient.escapeString(lineId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postCartsCartLineItemsItemValidateBeforeCall(String id, String lineId, StorePostCartsCartLineItemsItemReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling postCartsCartLineItemsItem(Async)"); - } - // verify the required parameter 'lineId' is set - if (lineId == null) { - throw new ApiException("Missing the required parameter 'lineId' when calling postCartsCartLineItemsItem(Async)"); - } - - com.squareup.okhttp.Call call = postCartsCartLineItemsItemCall(id, lineId, body, progressListener, progressRequestListener); - return call; - - - - - + public AddLineItemRequest addLineItem(String id) throws ApiException { + return new AddLineItemRequest(medusaSdkClient, id); } /** @@ -1159,266 +131,24 @@ private com.squareup.okhttp.Call postCartsCartLineItemsItemValidateBeforeCall(St * Updates a Line Item if the desired quantity can be fulfilled. * @param id The id of the Cart. (required) * @param lineId The id of the Line Item. (required) - * @param body (optional) + * body (optional) * @return StoreCartsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCartsRes postCartsCartLineItemsItem(String id, String lineId, StorePostCartsCartLineItemsItemReq body) throws ApiException { - ApiResponse resp = postCartsCartLineItemsItemWithHttpInfo(id, lineId, body); - return resp.getData(); - } - - /** - * Update a Line Item - * Updates a Line Item if the desired quantity can be fulfilled. - * @param id The id of the Cart. (required) - * @param lineId The id of the Line Item. (required) - * @param body (optional) - * @return ApiResponse<StoreCartsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postCartsCartLineItemsItemWithHttpInfo(String id, String lineId, StorePostCartsCartLineItemsItemReq body) throws ApiException { - com.squareup.okhttp.Call call = postCartsCartLineItemsItemValidateBeforeCall(id, lineId, body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Update a Line Item (asynchronously) - * Updates a Line Item if the desired quantity can be fulfilled. - * @param id The id of the Cart. (required) - * @param lineId The id of the Line Item. (required) - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postCartsCartLineItemsItemAsync(String id, String lineId, StorePostCartsCartLineItemsItemReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postCartsCartLineItemsItemValidateBeforeCall(id, lineId, body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postCartsCartPaymentSession - * @param id The ID of the Cart. (required) - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postCartsCartPaymentSessionCall(String id, StorePostCartsCartPaymentSessionReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/carts/{id}/payment-session" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postCartsCartPaymentSessionValidateBeforeCall(String id, StorePostCartsCartPaymentSessionReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling postCartsCartPaymentSession(Async)"); - } - - com.squareup.okhttp.Call call = postCartsCartPaymentSessionCall(id, body, progressListener, progressRequestListener); - return call; - - - - - + public UpdateLineItemRequest updateLineItem(String id, String lineId) throws ApiException { + return new UpdateLineItemRequest(medusaSdkClient, id, lineId); } /** * Select a Payment Session * Selects a Payment Session as the session intended to be used towards the completion of the Cart. * @param id The ID of the Cart. (required) - * @param body (optional) + * body (optional) * @return StoreCartsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCartsRes postCartsCartPaymentSession(String id, StorePostCartsCartPaymentSessionReq body) throws ApiException { - ApiResponse resp = postCartsCartPaymentSessionWithHttpInfo(id, body); - return resp.getData(); - } - - /** - * Select a Payment Session - * Selects a Payment Session as the session intended to be used towards the completion of the Cart. - * @param id The ID of the Cart. (required) - * @param body (optional) - * @return ApiResponse<StoreCartsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postCartsCartPaymentSessionWithHttpInfo(String id, StorePostCartsCartPaymentSessionReq body) throws ApiException { - com.squareup.okhttp.Call call = postCartsCartPaymentSessionValidateBeforeCall(id, body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Select a Payment Session (asynchronously) - * Selects a Payment Session as the session intended to be used towards the completion of the Cart. - * @param id The ID of the Cart. (required) - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postCartsCartPaymentSessionAsync(String id, StorePostCartsCartPaymentSessionReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postCartsCartPaymentSessionValidateBeforeCall(id, body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postCartsCartPaymentSessionUpdate - * @param id The id of the Cart. (required) - * @param providerId The id of the payment provider. (required) - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postCartsCartPaymentSessionUpdateCall(String id, String providerId, StorePostCartsCartPaymentSessionUpdateReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/carts/{id}/payment-sessions/{provider_id}" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())) - .replaceAll("\\{" + "provider_id" + "\\}", medusaSdkClient.escapeString(providerId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postCartsCartPaymentSessionUpdateValidateBeforeCall(String id, String providerId, StorePostCartsCartPaymentSessionUpdateReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling postCartsCartPaymentSessionUpdate(Async)"); - } - // verify the required parameter 'providerId' is set - if (providerId == null) { - throw new ApiException("Missing the required parameter 'providerId' when calling postCartsCartPaymentSessionUpdate(Async)"); - } - - com.squareup.okhttp.Call call = postCartsCartPaymentSessionUpdateCall(id, providerId, body, progressListener, progressRequestListener); - return call; - - - - - + public SelectPaymentSessionRequest selectPaymentSession(String id) throws ApiException { + return new SelectPaymentSessionRequest(medusaSdkClient, id); } /** @@ -1426,130 +156,12 @@ private com.squareup.okhttp.Call postCartsCartPaymentSessionUpdateValidateBefore * Updates a Payment Session with additional data. * @param id The id of the Cart. (required) * @param providerId The id of the payment provider. (required) - * @param body (optional) + * body (optional) * @return StoreCartsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCartsRes postCartsCartPaymentSessionUpdate(String id, String providerId, StorePostCartsCartPaymentSessionUpdateReq body) throws ApiException { - ApiResponse resp = postCartsCartPaymentSessionUpdateWithHttpInfo(id, providerId, body); - return resp.getData(); - } - - /** - * Update a Payment Session - * Updates a Payment Session with additional data. - * @param id The id of the Cart. (required) - * @param providerId The id of the payment provider. (required) - * @param body (optional) - * @return ApiResponse<StoreCartsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postCartsCartPaymentSessionUpdateWithHttpInfo(String id, String providerId, StorePostCartsCartPaymentSessionUpdateReq body) throws ApiException { - com.squareup.okhttp.Call call = postCartsCartPaymentSessionUpdateValidateBeforeCall(id, providerId, body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Update a Payment Session (asynchronously) - * Updates a Payment Session with additional data. - * @param id The id of the Cart. (required) - * @param providerId The id of the payment provider. (required) - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postCartsCartPaymentSessionUpdateAsync(String id, String providerId, StorePostCartsCartPaymentSessionUpdateReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postCartsCartPaymentSessionUpdateValidateBeforeCall(id, providerId, body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postCartsCartPaymentSessions - * @param id The id of the Cart. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postCartsCartPaymentSessionsCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/carts/{id}/payment-sessions" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postCartsCartPaymentSessionsValidateBeforeCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling postCartsCartPaymentSessions(Async)"); - } - - com.squareup.okhttp.Call call = postCartsCartPaymentSessionsCall(id, progressListener, progressRequestListener); - return call; - - - - - + public UpdatePaymentSessionRequest updatePaymentSession(String id, String providerId) throws ApiException { + return new UpdatePaymentSessionRequest(medusaSdkClient, id, providerId); } /** @@ -1559,128 +171,8 @@ private com.squareup.okhttp.Call postCartsCartPaymentSessionsValidateBeforeCall( * @return StoreCartsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCartsRes postCartsCartPaymentSessions(String id) throws ApiException { - ApiResponse resp = postCartsCartPaymentSessionsWithHttpInfo(id); - return resp.getData(); - } - - /** - * Create Payment Sessions - * Creates Payment Sessions for each of the available Payment Providers in the Cart's Region. - * @param id The id of the Cart. (required) - * @return ApiResponse<StoreCartsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postCartsCartPaymentSessionsWithHttpInfo(String id) throws ApiException { - com.squareup.okhttp.Call call = postCartsCartPaymentSessionsValidateBeforeCall(id, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Create Payment Sessions (asynchronously) - * Creates Payment Sessions for each of the available Payment Providers in the Cart's Region. - * @param id The id of the Cart. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postCartsCartPaymentSessionsAsync(String id, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postCartsCartPaymentSessionsValidateBeforeCall(id, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postCartsCartPaymentSessionsSession - * @param id The id of the Cart. (required) - * @param providerId The id of the Payment Provider that created the Payment Session to be refreshed. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postCartsCartPaymentSessionsSessionCall(String id, String providerId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/carts/{id}/payment-sessions/{provider_id}/refresh" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())) - .replaceAll("\\{" + "provider_id" + "\\}", medusaSdkClient.escapeString(providerId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postCartsCartPaymentSessionsSessionValidateBeforeCall(String id, String providerId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling postCartsCartPaymentSessionsSession(Async)"); - } - // verify the required parameter 'providerId' is set - if (providerId == null) { - throw new ApiException("Missing the required parameter 'providerId' when calling postCartsCartPaymentSessionsSession(Async)"); - } - - com.squareup.okhttp.Call call = postCartsCartPaymentSessionsSessionCall(id, providerId, progressListener, progressRequestListener); - return call; - - - - - + public CreatePaymentSessionsRequest createPaymentSessions(String id) throws ApiException { + return new CreatePaymentSessionsRequest(medusaSdkClient, id); } /** @@ -1691,253 +183,20 @@ private com.squareup.okhttp.Call postCartsCartPaymentSessionsSessionValidateBefo * @return StoreCartsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCartsRes postCartsCartPaymentSessionsSession(String id, String providerId) throws ApiException { - ApiResponse resp = postCartsCartPaymentSessionsSessionWithHttpInfo(id, providerId); - return resp.getData(); - } - - /** - * Refresh a Payment Session - * Refreshes a Payment Session to ensure that it is in sync with the Cart - this is usually not necessary. - * @param id The id of the Cart. (required) - * @param providerId The id of the Payment Provider that created the Payment Session to be refreshed. (required) - * @return ApiResponse<StoreCartsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postCartsCartPaymentSessionsSessionWithHttpInfo(String id, String providerId) throws ApiException { - com.squareup.okhttp.Call call = postCartsCartPaymentSessionsSessionValidateBeforeCall(id, providerId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Refresh a Payment Session (asynchronously) - * Refreshes a Payment Session to ensure that it is in sync with the Cart - this is usually not necessary. - * @param id The id of the Cart. (required) - * @param providerId The id of the Payment Provider that created the Payment Session to be refreshed. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postCartsCartPaymentSessionsSessionAsync(String id, String providerId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postCartsCartPaymentSessionsSessionValidateBeforeCall(id, providerId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postCartsCartShippingMethod - * @param id The cart ID. (required) - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postCartsCartShippingMethodCall(String id, StorePostCartsCartShippingMethodReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/carts/{id}/shipping-methods" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postCartsCartShippingMethodValidateBeforeCall(String id, StorePostCartsCartShippingMethodReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling postCartsCartShippingMethod(Async)"); - } - - com.squareup.okhttp.Call call = postCartsCartShippingMethodCall(id, body, progressListener, progressRequestListener); - return call; - - - - - + public RefreshPaymentSessionRequest refreshPaymentSession(String id, String providerId) throws ApiException { + return new RefreshPaymentSessionRequest(medusaSdkClient, id, providerId); } /** * Add a Shipping Method * Adds a Shipping Method to the Cart. * @param id The cart ID. (required) - * @param body (optional) + * body (optional) * @return StoreCartsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCartsRes postCartsCartShippingMethod(String id, StorePostCartsCartShippingMethodReq body) throws ApiException { - ApiResponse resp = postCartsCartShippingMethodWithHttpInfo(id, body); - return resp.getData(); - } - - /** - * Add a Shipping Method - * Adds a Shipping Method to the Cart. - * @param id The cart ID. (required) - * @param body (optional) - * @return ApiResponse<StoreCartsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postCartsCartShippingMethodWithHttpInfo(String id, StorePostCartsCartShippingMethodReq body) throws ApiException { - com.squareup.okhttp.Call call = postCartsCartShippingMethodValidateBeforeCall(id, body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Add a Shipping Method (asynchronously) - * Adds a Shipping Method to the Cart. - * @param id The cart ID. (required) - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postCartsCartShippingMethodAsync(String id, StorePostCartsCartShippingMethodReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postCartsCartShippingMethodValidateBeforeCall(id, body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postCartsCartTaxes - * @param id The Cart ID. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postCartsCartTaxesCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/carts/{id}/taxes" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postCartsCartTaxesValidateBeforeCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling postCartsCartTaxes(Async)"); - } - - com.squareup.okhttp.Call call = postCartsCartTaxesCall(id, progressListener, progressRequestListener); - return call; - - - - - + public AddShippingMethodRequest addShippingMethod(String id) throws ApiException { + return new AddShippingMethodRequest(medusaSdkClient, id); } /** @@ -1947,56 +206,7 @@ private com.squareup.okhttp.Call postCartsCartTaxesValidateBeforeCall(String id, * @return StoreCartsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCartsRes postCartsCartTaxes(String id) throws ApiException { - ApiResponse resp = postCartsCartTaxesWithHttpInfo(id); - return resp.getData(); - } - - /** - * Calculate Cart Taxes - * Calculates taxes for a cart. Depending on the cart's region this may involve making 3rd party API calls to a Tax Provider service. - * @param id The Cart ID. (required) - * @return ApiResponse<StoreCartsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postCartsCartTaxesWithHttpInfo(String id) throws ApiException { - com.squareup.okhttp.Call call = postCartsCartTaxesValidateBeforeCall(id, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Calculate Cart Taxes (asynchronously) - * Calculates taxes for a cart. Depending on the cart's region this may involve making 3rd party API calls to a Tax Provider service. - * @param id The Cart ID. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postCartsCartTaxesAsync(String id, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postCartsCartTaxesValidateBeforeCall(id, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; + public CalculateCartTaxesRequest calculateCartTaxes(String id) throws ApiException { + return new CalculateCartTaxesRequest(medusaSdkClient, id); } } diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/AddLineItemRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/AddLineItemRequest.java new file mode 100644 index 0000000..2dba0b9 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/AddLineItemRequest.java @@ -0,0 +1,63 @@ +package mobi.appcent.medusa.store.model.request.cart; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCartsRes; +import mobi.appcent.medusa.store.model.response.StorePostCartsCartLineItemsReq; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 8.03.2023 + */ +public class AddLineItemRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private StorePostCartsCartLineItemsReq body; + + public AddLineItemRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + public AddLineItemRequest body(StorePostCartsCartLineItemsReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + // create path and map variables + String path = UrlConstant.CART_PATH + "/" + id + "/line-items"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/AddShippingMethodRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/AddShippingMethodRequest.java new file mode 100644 index 0000000..fb5bf73 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/AddShippingMethodRequest.java @@ -0,0 +1,63 @@ +package mobi.appcent.medusa.store.model.request.cart; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCartsRes; +import mobi.appcent.medusa.store.model.response.StorePostCartsCartShippingMethodReq; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 8.03.2023 + */ +public class AddShippingMethodRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private StorePostCartsCartShippingMethodReq body; + + public AddShippingMethodRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + public AddShippingMethodRequest body(StorePostCartsCartShippingMethodReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + // create path and map variables + String path = UrlConstant.CART_PATH + "/" + id + "/shipping-methods"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/CalculateCartTaxesRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/CalculateCartTaxesRequest.java new file mode 100644 index 0000000..b5af574 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/CalculateCartTaxesRequest.java @@ -0,0 +1,56 @@ +package mobi.appcent.medusa.store.model.request.cart; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCartsRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 8.03.2023 + */ +public class CalculateCartTaxesRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + + public CalculateCartTaxesRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + @Override + protected Call buildCall() throws ApiException { + // create path and map variables + String path = UrlConstant.CART_PATH + "/" + id + "/taxes"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/CompleteCartRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/CompleteCartRequest.java new file mode 100644 index 0000000..e450786 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/CompleteCartRequest.java @@ -0,0 +1,56 @@ +package mobi.appcent.medusa.store.model.request.cart; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCompleteCartRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 8.03.2023 + */ +public class CompleteCartRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + + public CompleteCartRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + @Override + protected Call buildCall() throws ApiException { + // create path and map variables + String path = UrlConstant.CART_PATH + "/" + id + "/complete"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/CreateCartRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/CreateCartRequest.java new file mode 100644 index 0000000..33f49d2 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/CreateCartRequest.java @@ -0,0 +1,61 @@ +package mobi.appcent.medusa.store.model.request.cart; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCartsRes; +import mobi.appcent.medusa.store.model.response.StorePostCartReq; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 8.03.2023 + */ +public class CreateCartRequest extends BaseRequest { + + private final MedusaSdkClient client; + private StorePostCartReq body; + + public CreateCartRequest(MedusaSdkClient client) { + this.client = client; + } + + public CreateCartRequest body(StorePostCartReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + // create path and map variables + String path = UrlConstant.CART_PATH; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/CreatePaymentSessionsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/CreatePaymentSessionsRequest.java new file mode 100644 index 0000000..c83e770 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/CreatePaymentSessionsRequest.java @@ -0,0 +1,52 @@ +package mobi.appcent.medusa.store.model.request.cart; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCartsRes; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by erenalpaslan on 8.03.2023 + */ +public class CreatePaymentSessionsRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + + public CreatePaymentSessionsRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + @Override + protected Call buildCall() throws ApiException { + // create path and map variables + String path = UrlConstant.CART_PATH + "/" + id + "/payment-session"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/DeleteLineItemRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/DeleteLineItemRequest.java new file mode 100644 index 0000000..3eda916 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/DeleteLineItemRequest.java @@ -0,0 +1,54 @@ +package mobi.appcent.medusa.store.model.request.cart; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCartsRes; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by erenalpaslan on 8.03.2023 + */ +public class DeleteLineItemRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private final String lineId; + + public DeleteLineItemRequest(MedusaSdkClient client, String id, String lineId) { + this.client = client; + this.id = id; + this.lineId = lineId; + } + + @Override + protected Call buildCall() throws ApiException { + // create path and map variables + String path = UrlConstant.CART_PATH + "/" + id + "/line-items/" + lineId; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.DELETE, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/DeletePaymentSessionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/DeletePaymentSessionRequest.java new file mode 100644 index 0000000..c3a55f6 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/DeletePaymentSessionRequest.java @@ -0,0 +1,55 @@ +package mobi.appcent.medusa.store.model.request.cart; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCartsRes; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by erenalpaslan on 8.03.2023 + */ +public class DeletePaymentSessionRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private final String providerId; + + public DeletePaymentSessionRequest(MedusaSdkClient client, String id, String providerId) { + this.client = client; + this.id = id; + this.providerId = providerId; + } + + @Override + protected Call buildCall() throws ApiException { + // create path and map variables + String path = UrlConstant.CART_PATH + "/" + id + "/payment-sessions/" + providerId; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.DELETE, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/GetCartRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/GetCartRequest.java new file mode 100644 index 0000000..0bc3451 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/GetCartRequest.java @@ -0,0 +1,56 @@ +package mobi.appcent.medusa.store.model.request.cart; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCartsRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 8.03.2023 + */ +public class GetCartRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + + public GetCartRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + @Override + protected Call buildCall() throws ApiException { + // create path and map variables + String path = UrlConstant.CART_PATH + "/" + id; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/RefreshPaymentSessionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/RefreshPaymentSessionRequest.java new file mode 100644 index 0000000..1b5d878 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/RefreshPaymentSessionRequest.java @@ -0,0 +1,56 @@ +package mobi.appcent.medusa.store.model.request.cart; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCartsRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 8.03.2023 + */ +public class RefreshPaymentSessionRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private final String providerId; + + public RefreshPaymentSessionRequest(MedusaSdkClient client, String id, String providerId) { + this.client = client; + this.id = id; + this.providerId = providerId; + } + + @Override + protected Call buildCall() throws ApiException { + // create path and map variables + String path = UrlConstant.CART_PATH + "/" + id + "/payment-sessions/" + providerId + "/refresh"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + return null; + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/RemoveDiscountRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/RemoveDiscountRequest.java new file mode 100644 index 0000000..7227229 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/RemoveDiscountRequest.java @@ -0,0 +1,58 @@ +package mobi.appcent.medusa.store.model.request.cart; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCartsRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 8.03.2023 + */ +public class RemoveDiscountRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private final String code; + + public RemoveDiscountRequest(MedusaSdkClient client, String id, String code) { + this.client = client; + this.id = id; + this.code = code; + } + + @Override + protected Call buildCall() throws ApiException { + // create path and map variables + String path = UrlConstant.CART_PATH + "/" + id + "/discounts/" + code; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.DELETE, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/SelectPaymentSessionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/SelectPaymentSessionRequest.java new file mode 100644 index 0000000..2d9502e --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/SelectPaymentSessionRequest.java @@ -0,0 +1,60 @@ +package mobi.appcent.medusa.store.model.request.cart; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCartsRes; +import mobi.appcent.medusa.store.model.response.StorePostCartsCartPaymentSessionReq; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by erenalpaslan on 8.03.2023 + */ +public class SelectPaymentSessionRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private StorePostCartsCartPaymentSessionReq body; + + public SelectPaymentSessionRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + public SelectPaymentSessionRequest body(StorePostCartsCartPaymentSessionReq body) { + this.body = body; + return this; + } + + + @Override + protected Call buildCall() throws ApiException { + // create path and map variables + String path = UrlConstant.CART_PATH + "/" + id + "/payment-session"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdateCartRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdateCartRequest.java new file mode 100644 index 0000000..88c7d56 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdateCartRequest.java @@ -0,0 +1,63 @@ +package mobi.appcent.medusa.store.model.request.cart; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCartsRes; +import mobi.appcent.medusa.store.model.response.StorePostCartReq; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 8.03.2023 + */ +public class UpdateCartRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private StorePostCartReq body; + + public UpdateCartRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + public UpdateCartRequest body(StorePostCartReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + // create path and map variables + String path = UrlConstant.CART_PATH + "/" + id; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdateLineItemRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdateLineItemRequest.java new file mode 100644 index 0000000..d5ffda2 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdateLineItemRequest.java @@ -0,0 +1,65 @@ +package mobi.appcent.medusa.store.model.request.cart; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCartsRes; +import mobi.appcent.medusa.store.model.response.StorePostCartsCartLineItemsItemReq; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 8.03.2023 + */ +public class UpdateLineItemRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private final String lineId; + private StorePostCartsCartLineItemsItemReq body; + + public UpdateLineItemRequest(MedusaSdkClient client, String id, String lineId) { + this.client = client; + this.id = id; + this.lineId = lineId; + } + + public UpdateLineItemRequest body(StorePostCartsCartLineItemsItemReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + // create path and map variables + String path = UrlConstant.CART_PATH + "/" + id + "/line-items/" + lineId; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdatePaymentSessionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdatePaymentSessionRequest.java new file mode 100644 index 0000000..c0f41aa --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdatePaymentSessionRequest.java @@ -0,0 +1,62 @@ +package mobi.appcent.medusa.store.model.request.cart; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCartsRes; +import mobi.appcent.medusa.store.model.response.StorePostCartsCartPaymentSessionUpdateReq; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by erenalpaslan on 8.03.2023 + */ +public class UpdatePaymentSessionRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private final String providerId; + private StorePostCartsCartPaymentSessionUpdateReq body; + + public UpdatePaymentSessionRequest(MedusaSdkClient client, String id, String providerId) { + this.client = client; + this.id = id; + this.providerId = providerId; + } + + public UpdatePaymentSessionRequest body(StorePostCartsCartPaymentSessionUpdateReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + // create path and map variables + String path = UrlConstant.CART_PATH + "/" + id + "/payment-session/" + providerId; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/test/java/mobi/appcent/medusa/store/api/CartApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/CartApiTest.java index 68f5603..3aeb3b0 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/CartApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/CartApiTest.java @@ -12,6 +12,10 @@ package mobi.appcent.medusa.store.api; +import mobi.appcent.medusa.store.model.request.cart.AddShippingMethodRequest; +import mobi.appcent.medusa.store.model.request.cart.CalculateCartTaxesRequest; +import mobi.appcent.medusa.store.model.request.cart.CreatePaymentSessionsRequest; +import mobi.appcent.medusa.store.model.request.cart.RefreshPaymentSessionRequest; import mobi.appcent.medusa.store.model.response.StoreCartsRes; import mobi.appcent.medusa.store.model.response.StoreCompleteCartRes; import mobi.appcent.medusa.store.model.response.StorePostCartReq; @@ -45,7 +49,7 @@ public class CartApiTest { public void deleteCartsCartDiscountsDiscountTest() throws Exception { String id = null; String code = null; - StoreCartsRes response = api.deleteCartsCartDiscountsDiscount(id, code); + StoreCartsRes response = api.removeDiscount(id, code).execute().getData(); // TODO: test validations } @@ -61,7 +65,7 @@ public void deleteCartsCartDiscountsDiscountTest() throws Exception { public void deleteCartsCartLineItemsItemTest() throws Exception { String id = null; String lineId = null; - StoreCartsRes response = api.deleteCartsCartLineItemsItem(id, lineId); + StoreCartsRes response = api.deleteLineItem(id, lineId).execute().getData(); // TODO: test validations } @@ -77,7 +81,7 @@ public void deleteCartsCartLineItemsItemTest() throws Exception { public void deleteCartsCartPaymentSessionsSessionTest() throws Exception { String id = null; String providerId = null; - StoreCartsRes response = api.deleteCartsCartPaymentSessionsSession(id, providerId); + StoreCartsRes response = api.deletePaymentSession(id, providerId).execute().getData(); // TODO: test validations } @@ -92,7 +96,7 @@ public void deleteCartsCartPaymentSessionsSessionTest() throws Exception { @Test public void getCartsCartTest() throws Exception { String id = null; - StoreCartsRes response = api.getCartsCart(id); + StoreCartsRes response = api.getCart(id).execute().getData(); // TODO: test validations } @@ -107,7 +111,7 @@ public void getCartsCartTest() throws Exception { @Test public void postCartTest() throws Exception { StorePostCartReq body = null; - StoreCartsRes response = api.postCart(body); + StoreCartsRes response = api.createCart().execute().getData(); // TODO: test validations } @@ -123,7 +127,7 @@ public void postCartTest() throws Exception { public void postCartsCartTest() throws Exception { String id = null; StorePostCartsCartReq body = null; - StoreCartsRes response = api.postCartsCart(id, body); + StoreCartsRes response = api.updateCart(id).execute().getData(); // TODO: test validations } @@ -138,7 +142,7 @@ public void postCartsCartTest() throws Exception { @Test public void postCartsCartCompleteTest() throws Exception { String id = null; - StoreCompleteCartRes response = api.postCartsCartComplete(id); + StoreCompleteCartRes response = api.completeCart(id).execute().getData(); // TODO: test validations } @@ -154,7 +158,7 @@ public void postCartsCartCompleteTest() throws Exception { public void postCartsCartLineItemsTest() throws Exception { String id = null; StorePostCartsCartLineItemsReq body = null; - StoreCartsRes response = api.postCartsCartLineItems(id, body); + StoreCartsRes response = api.addLineItem(id).execute().getData(); // TODO: test validations } @@ -171,7 +175,7 @@ public void postCartsCartLineItemsItemTest() throws Exception { String id = null; String lineId = null; StorePostCartsCartLineItemsItemReq body = null; - StoreCartsRes response = api.postCartsCartLineItemsItem(id, lineId, body); + StoreCartsRes response = api.updateLineItem(id, lineId).execute().getData(); // TODO: test validations } @@ -187,7 +191,7 @@ public void postCartsCartLineItemsItemTest() throws Exception { public void postCartsCartPaymentSessionTest() throws Exception { String id = null; StorePostCartsCartPaymentSessionReq body = null; - StoreCartsRes response = api.postCartsCartPaymentSession(id, body); + StoreCartsRes response = api.selectPaymentSession(id).execute().getData(); // TODO: test validations } @@ -204,7 +208,7 @@ public void postCartsCartPaymentSessionUpdateTest() throws Exception { String id = null; String providerId = null; StorePostCartsCartPaymentSessionUpdateReq body = null; - StoreCartsRes response = api.postCartsCartPaymentSessionUpdate(id, providerId, body); + StoreCartsRes response = api.updatePaymentSession(id, providerId).execute().getData(); // TODO: test validations } @@ -219,7 +223,7 @@ public void postCartsCartPaymentSessionUpdateTest() throws Exception { @Test public void postCartsCartPaymentSessionsTest() throws Exception { String id = null; - StoreCartsRes response = api.postCartsCartPaymentSessions(id); + StoreCartsRes response = api.createPaymentSessions(id).execute().getData(); // TODO: test validations } @@ -235,7 +239,7 @@ public void postCartsCartPaymentSessionsTest() throws Exception { public void postCartsCartPaymentSessionsSessionTest() throws Exception { String id = null; String providerId = null; - StoreCartsRes response = api.postCartsCartPaymentSessionsSession(id, providerId); + StoreCartsRes response = api.refreshPaymentSession(id, providerId).execute().getData(); // TODO: test validations } @@ -251,7 +255,7 @@ public void postCartsCartPaymentSessionsSessionTest() throws Exception { public void postCartsCartShippingMethodTest() throws Exception { String id = null; StorePostCartsCartShippingMethodReq body = null; - StoreCartsRes response = api.postCartsCartShippingMethod(id, body); + StoreCartsRes response = api.addShippingMethod(id).execute().getData(); // TODO: test validations } @@ -266,7 +270,7 @@ public void postCartsCartShippingMethodTest() throws Exception { @Test public void postCartsCartTaxesTest() throws Exception { String id = null; - StoreCartsRes response = api.postCartsCartTaxes(id); + StoreCartsRes response = api.calculateCartTaxes(id).execute().getData(); // TODO: test validations } From 7e0d7d97611491485a68c53e5f172ed0fcbbcdec Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Wed, 8 Mar 2023 22:53:48 +0300 Subject: [PATCH 03/32] feat(collection-api): Refactor collection api (#3) --- .../medusa/store/api/CollectionApi.java | 259 +----------------- .../store/common/QueryParamConstant.java | 11 + .../collection/GetCollectionRequest.java | 56 ++++ .../collection/ListCollectionsRequest.java | 93 +++++++ .../medusa/store/api/CollectionApiTest.java | 4 +- 5 files changed, 172 insertions(+), 251 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/collection/GetCollectionRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/collection/ListCollectionsRequest.java diff --git a/src/main/java/mobi/appcent/medusa/store/api/CollectionApi.java b/src/main/java/mobi/appcent/medusa/store/api/CollectionApi.java index 98b11ff..0484cf9 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/CollectionApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/CollectionApi.java @@ -20,6 +20,8 @@ import java.io.IOException; +import mobi.appcent.medusa.store.model.request.collection.GetCollectionRequest; +import mobi.appcent.medusa.store.model.request.collection.ListCollectionsRequest; import mobi.appcent.medusa.store.model.response.CreatedAt; import mobi.appcent.medusa.store.model.response.StoreCollectionsListRes; import mobi.appcent.medusa.store.model.response.StoreCollectionsRes; @@ -44,212 +46,20 @@ public MedusaSdkClient getApiClient() { public void setApiClient(MedusaSdkClient medusaSdkClient) { this.medusaSdkClient = medusaSdkClient; - } - - /** - * Build call for getCollections - * @param offset The number of collections to skip before starting to collect the collections set (optional, default to 0) - * @param limit The number of collections to return (optional, default to 10) - * @param createdAt Date comparison for when resulting collections were created. (optional) - * @param updatedAt Date comparison for when resulting collections were updated. (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getCollectionsCall(Integer offset, Integer limit, CreatedAt createdAt, UpdatedAt updatedAt, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/collections"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - if (offset != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("offset", offset)); - if (limit != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("limit", limit)); - if (createdAt != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("created_at", createdAt)); - if (updatedAt != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("updated_at", updatedAt)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getCollectionsValidateBeforeCall(Integer offset, Integer limit, CreatedAt createdAt, UpdatedAt updatedAt, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = getCollectionsCall(offset, limit, createdAt, updatedAt, progressListener, progressRequestListener); - return call; - - - - - } /** * List Collections * Retrieve a list of Product Collection. - * @param offset The number of collections to skip before starting to collect the collections set (optional, default to 0) - * @param limit The number of collections to return (optional, default to 10) - * @param createdAt Date comparison for when resulting collections were created. (optional) - * @param updatedAt Date comparison for when resulting collections were updated. (optional) + * offset The number of collections to skip before starting to collect the collections set (optional, default to 0) + * limit The number of collections to return (optional, default to 10) + * createdAt Date comparison for when resulting collections were created. (optional) + * updatedAt Date comparison for when resulting collections were updated. (optional) * @return StoreCollectionsListRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCollectionsListRes getCollections(Integer offset, Integer limit, CreatedAt createdAt, UpdatedAt updatedAt) throws ApiException { - ApiResponse resp = getCollectionsWithHttpInfo(offset, limit, createdAt, updatedAt); - return resp.getData(); - } - - /** - * List Collections - * Retrieve a list of Product Collection. - * @param offset The number of collections to skip before starting to collect the collections set (optional, default to 0) - * @param limit The number of collections to return (optional, default to 10) - * @param createdAt Date comparison for when resulting collections were created. (optional) - * @param updatedAt Date comparison for when resulting collections were updated. (optional) - * @return ApiResponse<StoreCollectionsListRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getCollectionsWithHttpInfo(Integer offset, Integer limit, CreatedAt createdAt, UpdatedAt updatedAt) throws ApiException { - com.squareup.okhttp.Call call = getCollectionsValidateBeforeCall(offset, limit, createdAt, updatedAt, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * List Collections (asynchronously) - * Retrieve a list of Product Collection. - * @param offset The number of collections to skip before starting to collect the collections set (optional, default to 0) - * @param limit The number of collections to return (optional, default to 10) - * @param createdAt Date comparison for when resulting collections were created. (optional) - * @param updatedAt Date comparison for when resulting collections were updated. (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getCollectionsAsync(Integer offset, Integer limit, CreatedAt createdAt, UpdatedAt updatedAt, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getCollectionsValidateBeforeCall(offset, limit, createdAt, updatedAt, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getCollectionsCollection - * @param id The id of the Product Collection (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getCollectionsCollectionCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/collections/{id}" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getCollectionsCollectionValidateBeforeCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling getCollectionsCollection(Async)"); - } - - com.squareup.okhttp.Call call = getCollectionsCollectionCall(id, progressListener, progressRequestListener); - return call; - - - - - + public ListCollectionsRequest getCollections() throws ApiException { + return new ListCollectionsRequest(medusaSdkClient); } /** @@ -259,56 +69,7 @@ private com.squareup.okhttp.Call getCollectionsCollectionValidateBeforeCall(Stri * @return StoreCollectionsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCollectionsRes getCollectionsCollection(String id) throws ApiException { - ApiResponse resp = getCollectionsCollectionWithHttpInfo(id); - return resp.getData(); - } - - /** - * Get a Collection - * Retrieves a Product Collection. - * @param id The id of the Product Collection (required) - * @return ApiResponse<StoreCollectionsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getCollectionsCollectionWithHttpInfo(String id) throws ApiException { - com.squareup.okhttp.Call call = getCollectionsCollectionValidateBeforeCall(id, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Get a Collection (asynchronously) - * Retrieves a Product Collection. - * @param id The id of the Product Collection (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getCollectionsCollectionAsync(String id, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getCollectionsCollectionValidateBeforeCall(id, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; + public GetCollectionRequest getCollectionsCollection(String id) throws ApiException { + return new GetCollectionRequest(medusaSdkClient, id); } } diff --git a/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java b/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java new file mode 100644 index 0000000..45376d4 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java @@ -0,0 +1,11 @@ +package mobi.appcent.medusa.store.common; + +/** + * Created by erenalpaslan on 8.03.2023 + */ +public class QueryParamConstant { + public static final String OFFSET = "offset"; + public static final String LIMIT = "limit"; + public static final String CREATED_AT = "created_at"; + public static final String UPDATED_AT = "updated_at"; +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/collection/GetCollectionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/collection/GetCollectionRequest.java new file mode 100644 index 0000000..c713386 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/collection/GetCollectionRequest.java @@ -0,0 +1,56 @@ +package mobi.appcent.medusa.store.model.request.collection; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.QueryParamConstant; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCollectionsRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 8.03.2023 + */ +public class GetCollectionRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + + public GetCollectionRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.COLLECTION_PATH + "/" + id; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/collection/ListCollectionsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/collection/ListCollectionsRequest.java new file mode 100644 index 0000000..1f4788f --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/collection/ListCollectionsRequest.java @@ -0,0 +1,93 @@ +package mobi.appcent.medusa.store.model.request.collection; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.QueryParamConstant; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.CreatedAt; +import mobi.appcent.medusa.store.model.response.StoreCollectionsListRes; +import mobi.appcent.medusa.store.model.response.UpdatedAt; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 8.03.2023 + */ +public class ListCollectionsRequest extends BaseRequest { + + private final MedusaSdkClient client; + private Integer offset; + private Integer limit; + private CreatedAt createdAt; + private UpdatedAt updatedAt; + + public ListCollectionsRequest(MedusaSdkClient client) { + this.client = client; + } + + public ListCollectionsRequest offset(Integer offset) { + this.offset = offset; + return this; + } + + public ListCollectionsRequest limit(Integer limit) { + this.limit = limit; + return this; + } + + public ListCollectionsRequest createdAt(CreatedAt createdAt) { + this.createdAt = createdAt; + return this; + } + + public ListCollectionsRequest updatedAt(UpdatedAt updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + + String path = UrlConstant.COLLECTION_PATH; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + + List localVarQueryParams = new ArrayList(); + + if (offset != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.OFFSET, offset)); + if (limit != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.LIMIT, limit)); + if (createdAt != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CREATED_AT, createdAt)); + if (updatedAt != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.UPDATED_AT, updatedAt)); + + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/test/java/mobi/appcent/medusa/store/api/CollectionApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/CollectionApiTest.java index 94420cb..2106af7 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/CollectionApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/CollectionApiTest.java @@ -42,7 +42,7 @@ public void getCollectionsTest() throws Exception { Integer limit = null; CreatedAt createdAt = null; UpdatedAt updatedAt = null; - StoreCollectionsListRes response = api.getCollections(offset, limit, createdAt, updatedAt); + StoreCollectionsListRes response = api.getCollections().execute().getData(); // TODO: test validations } @@ -57,7 +57,7 @@ public void getCollectionsTest() throws Exception { @Test public void getCollectionsCollectionTest() throws Exception { String id = null; - StoreCollectionsRes response = api.getCollectionsCollection(id); + StoreCollectionsRes response = api.getCollectionsCollection(id).execute().getData(); // TODO: test validations } From d98eda60ef6bdfab3a0616d67d86bf919fa68ec0 Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Thu, 9 Mar 2023 22:22:02 +0300 Subject: [PATCH 04/32] feat(customer-api): Refactor customers api (#4) --- .../appcent/medusa/store/api/CustomerApi.java | 1302 +---------------- .../store/common/QueryParamConstant.java | 15 + .../request/customer/AddShippingAddress.java | 57 + .../customer/CreateCustomerRequest.java | 57 + .../customer/DeleteAddressRequest.java | 56 + .../request/customer/GetCustomerRequest.java | 54 + .../customer/GetPaymentMethodsRequest.java | 51 + .../request/customer/ListOrdersRequest.java | 204 +++ .../customer/PasswordResetRequest.java | 59 + .../customer/ResetPasswordRequest.java | 60 + .../customer/UpdateCustomerRequest.java | 61 + .../UpdateShippingAddressRequest.java | 60 + .../medusa/store/api/CustomerApiTest.java | 20 +- 13 files changed, 799 insertions(+), 1257 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/customer/AddShippingAddress.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/customer/CreateCustomerRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/customer/DeleteAddressRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/customer/GetCustomerRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/customer/GetPaymentMethodsRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/customer/ListOrdersRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/customer/PasswordResetRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/customer/ResetPasswordRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/customer/UpdateCustomerRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/customer/UpdateShippingAddressRequest.java diff --git a/src/main/java/mobi/appcent/medusa/store/api/CustomerApi.java b/src/main/java/mobi/appcent/medusa/store/api/CustomerApi.java index 7c5004c..2236805 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/CustomerApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/CustomerApi.java @@ -1,9 +1,9 @@ /* * Medusa Storefront API - * API reference for Medusa's Storefront endpoints. All endpoints are prefixed with `/store`. ## Authentication To send requests as an authenticated customer, you must use the Cookie Session ID. ## Expanding Fields In many endpoints you'll find an `expand` query parameter that can be passed to the endpoint. You can use the `expand` query parameter to unpack an entity's relations and return them in the response. Please note that the relations you pass to `expand` replace any relations that are expanded by default in the request. ### Expanding One Relation For example, when you retrieve a product, you can retrieve its collection by passing to the `expand` query parameter the value `collection`: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand=collection\" ``` ### Expanding Multiple Relations You can expand more than one relation by separating the relations in the `expand` query parameter with a comma. For example, to retrieve both the variants and the collection of a product, pass to the `expand` query parameter the value `variants,collection`: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand=variants,collection\" ``` ### Prevent Expanding Relations Some requests expand relations by default. You can prevent that by passing an empty expand value to retrieve an entity without any extra relations. For example: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand\" ``` This would retrieve the product with only its properties, without any relations like `collection`. ## Selecting Fields In many endpoints you'll find a `fields` query parameter that can be passed to the endpoint. You can use the `fields` query parameter to specify which fields in the entity should be returned in the response. Please note that if you pass a `fields` query parameter, only the fields you pass in the value along with the `id` of the entity will be returned in the response. Also, the `fields` query parameter does not affect the expanded relations. You'll have to use the `expand` parameter instead. ### Selecting One Field For example, when you retrieve a list of products, you can retrieve only the titles of the products by passing `title` as a value to the `fields` query parameter: ```bash curl \"http://localhost:9000/store/products?fields=title\" ``` As mentioned above, the expanded relations such as `variants` will still be returned as they're not affected by the `fields` parameter. You can ensure that only the `title` field is returned by passing an empty value to the `expand` query parameter. For example: ```bash curl \"http://localhost:9000/store/products?fields=title&expand\" ``` ### Selecting Multiple Fields You can pass more than one field by seperating the field names in the `fields` query parameter with a comma. For example, to select the `title` and `handle` of a product: ```bash curl \"http://localhost:9000/store/products?fields=title,handle\" ``` ### Retrieve Only the ID You can pass an empty `fields` query parameter to return only the ID of an entity. For example: ```bash curl \"http://localhost:9000/store/products?fields\" ``` You can also pair with an empty `expand` query parameter to ensure that the relations aren't retrieved as well. For example: ```bash curl \"http://localhost:9000/store/products?fields&expand\" ``` ## Query Parameter Types This section covers how to pass some common data types as query parameters. This is useful if you're sending requests to the API endpoints and not using our JS Client. For example, when using cURL or Postman. ### Strings You can pass a string value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?title=Shirt\" ``` If the string has any characters other than letters and numbers, you must encode them. For example, if the string has spaces, you can encode the space with `+` or `%20`: ```bash curl \"http://localhost:9000/store/products?title=Blue%20Shirt\" ``` You can use tools like [this one](https://www.urlencoder.org/) to learn how a value can be encoded. ### Integers You can pass an integer value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?offset=1\" ``` ### Boolean You can pass a boolean value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?is_giftcard=true\" ``` ### Date and DateTime You can pass a date value in the form `=`. The date must be in the format `YYYY-MM-DD`. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17\" ``` You can also pass the time using the format `YYYY-MM-DDTHH:MM:SSZ`. Please note that the `T` and `Z` here are fixed. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17T07:22:30Z\" ``` ### Array Each array value must be passed as a separate query parameter in the form `[]=`. You can also specify the index of each parameter in the brackets `[0]=`. For example: ```bash curl -g \"http://localhost:9000/store/products?sales_channel_id[]=sc_01GPGVB42PZ7N3YQEP2WDM7PC7&sales_channel_id[]=sc_234PGVB42PZ7N3YQEP2WDM7PC7\" ``` Note that the `-g` parameter passed to `curl` disables errors being thrown for using the brackets. Read more [here](https://curl.se/docs/manpage.html#-g). ### Object Object parameters must be passed as separate query parameters in the form `[]=`. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17&created_at[gt]=2022-09-17\" ``` ## Pagination ### Query Parameters In listing endpoints, such as list customers or list products, you can control the pagination using the query parameters `limit` and `offset`. `limit` is used to specify the maximum number of items that can be return in the response. `offset` is used to specify how many items to skip before returning the resulting entities. You can use the `offset` query parameter to change between pages. For example, if the limit is 50, at page 1 the offset should be 0; at page 2 the offset should be 50, and so on. For example, to limit the number of products returned in the List Products endpoint: ```bash curl \"http://localhost:9000/store/products?limit=5\" ``` ### Response Fields In the response of listing endpoints, aside from the entities retrieved, there are three pagination-related fields returned: `count`, `limit`, and `offset`. Similar to the query parameters, `limit` is the maximum number of items that can be returned in the response, and `field` is the number of items that were skipped before the entities in the result. `count` is the total number of available items of this entity. It can be used to determine how many pages are there. For example, if the `count` is 100 and the `limit` is 50, you can divide the `count` by the `limit` to get the number of pages: `100/50 = 2 pages`. + * API reference for Medusa's Storefront endpoints. All endpoints are prefixed with `/store`. ## Authentication To send requests as an authenticated customer, you must use the Cookie Session ID. ## Expanding Fields In many endpoints you'll find an `expand` query parameter that can be passed to the endpoint. You can use the `expand` query parameter to unpack an entity's relations and return them in the response. Please note that the relations you pass to `expand` replace any relations that are expanded by default in the request. ### Expanding One Relation For example, when you retrieve a product, you can retrieve its collection by passing to the `expand` query parameter the value `collection`: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand=collection\" ``` ### Expanding Multiple Relations You can expand more than one relation by separating the relations in the `expand` query parameter with a comma. For example, to retrieve both the variants and the collection of a product, pass to the `expand` query parameter the value `variants,collection`: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand=variants,collection\" ``` ### Prevent Expanding Relations Some requests expand relations by default. You can prevent that by passing an empty expand value to retrieve an entity without any extra relations. For example: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand\" ``` This would retrieve the product with only its properties, without any relations like `collection`. ## Selecting Fields In many endpoints you'll find a `fields` query parameter that can be passed to the endpoint. You can use the `fields` query parameter to specify which fields in the entity should be returned in the response. Please note that if you pass a `fields` query parameter, only the fields you pass in the value along with the `id` of the entity will be returned in the response. Also, the `fields` query parameter does not affect the expanded relations. You'll have to use the `expand` parameter instead. ### Selecting One Field For example, when you retrieve a list of products, you can retrieve only the titles of the products by passing `title` as a value to the `fields` query parameter: ```bash curl \"http://localhost:9000/store/products?fields=title\" ``` As mentioned above, the expanded relations such as `variants` will still be returned as they're not affected by the `fields` parameter. You can ensure that only the `title` field is returned by passing an empty value to the `expand` query parameter. For example: ```bash curl \"http://localhost:9000/store/products?fields=title&expand\" ``` ### Selecting Multiple Fields You can pass more than one field by seperating the field names in the `fields` query parameter with a comma. For example, to select the `title` and `handle` of a product: ```bash curl \"http://localhost:9000/store/products?fields=title,handle\" ``` ### Retrieve Only the ID You can pass an empty `fields` query parameter to return only the ID of an entity. For example: ```bash curl \"http://localhost:9000/store/products?fields\" ``` You can also pair with an empty `expand` query parameter to ensure that the relations aren't retrieved as well. For example: ```bash curl \"http://localhost:9000/store/products?fields&expand\" ``` ## Query Parameter Types This section covers how to pass some common data types as query parameters. This is useful if you're sending requests to the API endpoints and not using our JS Client. For example, when using cURL or Postman. ### Strings You can pass a string value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?title=Shirt\" ``` If the string has any characters other than letters and numbers, you must encode them. For example, if the string has spaces, you can encode the space with `+` or `%20`: ```bash curl \"http://localhost:9000/store/products?title=Blue%20Shirt\" ``` You can use tools like [this one](https://www.urlencoder.org/) to learn how a value can be encoded. ### Integers You can pass an integer value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?offset=1\" ``` ### Boolean You can pass a boolean value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?is_giftcard=true\" ``` ### Date and DateTime You can pass a date value in the form `=`. The date must be in the format `YYYY-MM-DD`. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17\" ``` You can also pass the time using the format `YYYY-MM-DDTHH:MM:SSZ`. Please note that the `T` and `Z` here are fixed. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17T07:22:30Z\" ``` ### Array Each array value must be passed as a separate query parameter in the form `[]=`. You can also specify the index of each parameter in the brackets `[0]=`. For example: ```bash curl -g \"http://localhost:9000/store/products?sales_channel_id[]=sc_01GPGVB42PZ7N3YQEP2WDM7PC7&sales_channel_id[]=sc_234PGVB42PZ7N3YQEP2WDM7PC7\" ``` Note that the `-g` parameter passed to `curl` disables errors being thrown for using the brackets. Read more [here](https://curl.se/docs/manpage.html#-g). ### Object Object parameters must be passed as separate query parameters in the form `[]=`. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17&created_at[gt]=2022-09-17\" ``` ## Pagination ### Query Parameters In listing endpoints, such as list customers or list products, you can control the pagination using the query parameters `limit` and `offset`. `limit` is used to specify the maximum number of items that can be return in the response. `offset` is used to specify how many items to skip before returning the resulting entities. You can use the `offset` query parameter to change between pages. For example, if the limit is 50, at page 1 the offset should be 0; at page 2 the offset should be 50, and so on. For example, to limit the number of products returned in the List Products endpoint: ```bash curl \"http://localhost:9000/store/products?limit=5\" ``` ### Response Fields In the response of listing endpoints, aside from the entities retrieved, there are three pagination-related fields returned: `count`, `limit`, and `offset`. Similar to the query parameters, `limit` is the maximum number of items that can be returned in the response, and `field` is the number of items that were skipped before the entities in the result. `count` is the total number of available items of this entity. It can be used to determine how many pages are there. For example, if the `count` is 100 and the `limit` is 50, you can divide the `count` by the `limit` to get the number of pages: `100/50 = 2 pages`. * * OpenAPI spec version: 1.0.0 - * + * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -15,29 +15,8 @@ import mobi.appcent.medusa.store.*; import mobi.appcent.medusa.store.MedusaSdkClient; -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - -import mobi.appcent.medusa.store.model.response.CanceledAt; -import mobi.appcent.medusa.store.model.response.CreatedAt1; -import mobi.appcent.medusa.store.model.response.StoreCustomersListOrdersRes; -import mobi.appcent.medusa.store.model.response.StoreCustomersListPaymentMethodsRes; -import mobi.appcent.medusa.store.model.response.StoreCustomersRes; -import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerAddressesAddressReq; -import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerAddressesReq; -import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerPasswordTokenReq; -import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerReq; -import mobi.appcent.medusa.store.model.response.StorePostCustomersReq; -import mobi.appcent.medusa.store.model.response.StorePostCustomersResetPasswordReq; -import mobi.appcent.medusa.store.model.response.UpdatedAt1; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import mobi.appcent.medusa.store.model.request.customer.*; public class CustomerApi { private MedusaSdkClient medusaSdkClient; @@ -52,1312 +31,141 @@ public MedusaSdkClient getApiClient() { public void setApiClient(MedusaSdkClient medusaSdkClient) { this.medusaSdkClient = medusaSdkClient; - } - - /** - * Build call for deleteCustomersCustomerAddressesAddress - * @param addressId The id of the Address to remove. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteCustomersCustomerAddressesAddressCall(String addressId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/customers/me/addresses/{address_id}" - .replaceAll("\\{" + "address_id" + "\\}", medusaSdkClient.escapeString(addressId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return medusaSdkClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteCustomersCustomerAddressesAddressValidateBeforeCall(String addressId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'addressId' is set - if (addressId == null) { - throw new ApiException("Missing the required parameter 'addressId' when calling deleteCustomersCustomerAddressesAddress(Async)"); - } - - com.squareup.okhttp.Call call = deleteCustomersCustomerAddressesAddressCall(addressId, progressListener, progressRequestListener); - return call; - - - - - } /** * Delete an Address * Removes an Address from the Customer's saved addresses. + * * @param addressId The id of the Address to remove. (required) * @return StoreCustomersRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCustomersRes deleteCustomersCustomerAddressesAddress(String addressId) throws ApiException { - ApiResponse resp = deleteCustomersCustomerAddressesAddressWithHttpInfo(addressId); - return resp.getData(); - } - - /** - * Delete an Address - * Removes an Address from the Customer's saved addresses. - * @param addressId The id of the Address to remove. (required) - * @return ApiResponse<StoreCustomersRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteCustomersCustomerAddressesAddressWithHttpInfo(String addressId) throws ApiException { - com.squareup.okhttp.Call call = deleteCustomersCustomerAddressesAddressValidateBeforeCall(addressId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Delete an Address (asynchronously) - * Removes an Address from the Customer's saved addresses. - * @param addressId The id of the Address to remove. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteCustomersCustomerAddressesAddressAsync(String addressId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteCustomersCustomerAddressesAddressValidateBeforeCall(addressId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getCustomersCustomer - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getCustomersCustomerCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/customers/me"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getCustomersCustomerValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = getCustomersCustomerCall(progressListener, progressRequestListener); - return call; - - - - - + public DeleteAddressRequest deleteAddressRequest(String addressId) throws ApiException { + return new DeleteAddressRequest(medusaSdkClient, addressId); } /** * Get a Customer * Retrieves a Customer - the Customer must be logged in to retrieve their details. + * * @return StoreCustomersRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCustomersRes getCustomersCustomer() throws ApiException { - ApiResponse resp = getCustomersCustomerWithHttpInfo(); - return resp.getData(); - } - - /** - * Get a Customer - * Retrieves a Customer - the Customer must be logged in to retrieve their details. - * @return ApiResponse<StoreCustomersRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getCustomersCustomerWithHttpInfo() throws ApiException { - com.squareup.okhttp.Call call = getCustomersCustomerValidateBeforeCall(null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Get a Customer (asynchronously) - * Retrieves a Customer - the Customer must be logged in to retrieve their details. - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getCustomersCustomerAsync(final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getCustomersCustomerValidateBeforeCall(progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getCustomersCustomerOrders - * @param q Query used for searching orders. (optional) - * @param id Id of the order to search for. (optional) - * @param status Status to search for. (optional) - * @param fulfillmentStatus Fulfillment status to search for. (optional) - * @param paymentStatus Payment status to search for. (optional) - * @param displayId Display id to search for. (optional) - * @param cartId to search for. (optional) - * @param email to search for. (optional) - * @param regionId to search for. (optional) - * @param currencyCode The 3 character ISO currency code to set prices based on. (optional) - * @param taxRate to search for. (optional) - * @param createdAt Date comparison for when resulting collections were created. (optional) - * @param updatedAt Date comparison for when resulting collections were updated. (optional) - * @param canceledAt Date comparison for when resulting collections were canceled. (optional) - * @param limit How many orders to return. (optional, default to 10) - * @param offset The offset in the resulting orders. (optional, default to 0) - * @param fields (Comma separated string) Which fields should be included in the resulting orders. (optional) - * @param expand (Comma separated string) Which relations should be expanded in the resulting orders. (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getCustomersCustomerOrdersCall(String q, String id, List status, List fulfillmentStatus, List paymentStatus, String displayId, String cartId, String email, String regionId, String currencyCode, String taxRate, CreatedAt1 createdAt, UpdatedAt1 updatedAt, CanceledAt canceledAt, Integer limit, Integer offset, String fields, String expand, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/customers/me/orders"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - if (q != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("q", q)); - if (id != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("id", id)); - if (status != null) - localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "status", status)); - if (fulfillmentStatus != null) - localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "fulfillment_status", fulfillmentStatus)); - if (paymentStatus != null) - localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "payment_status", paymentStatus)); - if (displayId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("display_id", displayId)); - if (cartId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("cart_id", cartId)); - if (email != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("email", email)); - if (regionId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("region_id", regionId)); - if (currencyCode != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("currency_code", currencyCode)); - if (taxRate != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("tax_rate", taxRate)); - if (createdAt != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("created_at", createdAt)); - if (updatedAt != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("updated_at", updatedAt)); - if (canceledAt != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("canceled_at", canceledAt)); - if (limit != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("limit", limit)); - if (offset != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("offset", offset)); - if (fields != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("fields", fields)); - if (expand != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("expand", expand)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getCustomersCustomerOrdersValidateBeforeCall(String q, String id, List status, List fulfillmentStatus, List paymentStatus, String displayId, String cartId, String email, String regionId, String currencyCode, String taxRate, CreatedAt1 createdAt, UpdatedAt1 updatedAt, CanceledAt canceledAt, Integer limit, Integer offset, String fields, String expand, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = getCustomersCustomerOrdersCall(q, id, status, fulfillmentStatus, paymentStatus, displayId, cartId, email, regionId, currencyCode, taxRate, createdAt, updatedAt, canceledAt, limit, offset, fields, expand, progressListener, progressRequestListener); - return call; - - - - - + public GetCustomerRequest getCustomer() throws ApiException { + return new GetCustomerRequest(medusaSdkClient); } /** * List Orders * Retrieves a list of a Customer's Orders. - * @param q Query used for searching orders. (optional) - * @param id Id of the order to search for. (optional) - * @param status Status to search for. (optional) - * @param fulfillmentStatus Fulfillment status to search for. (optional) - * @param paymentStatus Payment status to search for. (optional) - * @param displayId Display id to search for. (optional) - * @param cartId to search for. (optional) - * @param email to search for. (optional) - * @param regionId to search for. (optional) - * @param currencyCode The 3 character ISO currency code to set prices based on. (optional) - * @param taxRate to search for. (optional) - * @param createdAt Date comparison for when resulting collections were created. (optional) - * @param updatedAt Date comparison for when resulting collections were updated. (optional) - * @param canceledAt Date comparison for when resulting collections were canceled. (optional) - * @param limit How many orders to return. (optional, default to 10) - * @param offset The offset in the resulting orders. (optional, default to 0) - * @param fields (Comma separated string) Which fields should be included in the resulting orders. (optional) - * @param expand (Comma separated string) Which relations should be expanded in the resulting orders. (optional) + * q Query used for searching orders. (optional) + * id Id of the order to search for. (optional) + * status Status to search for. (optional) + * fulfillmentStatus Fulfillment status to search for. (optional) + * paymentStatus Payment status to search for. (optional) + * displayId Display id to search for. (optional) + * cartId to search for. (optional) + * email to search for. (optional) + * regionId to search for. (optional) + * currencyCode The 3 character ISO currency code to set prices based on. (optional) + * taxRate to search for. (optional) + * createdAt Date comparison for when resulting collections were created. (optional) + * updatedAt Date comparison for when resulting collections were updated. (optional) + * canceledAt Date comparison for when resulting collections were canceled. (optional) + * limit How many orders to return. (optional, default to 10) + * offset The offset in the resulting orders. (optional, default to 0) + * fields (Comma separated string) Which fields should be included in the resulting orders. (optional) + * expand (Comma separated string) Which relations should be expanded in the resulting orders. (optional) + * * @return StoreCustomersListOrdersRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCustomersListOrdersRes getCustomersCustomerOrders(String q, String id, List status, List fulfillmentStatus, List paymentStatus, String displayId, String cartId, String email, String regionId, String currencyCode, String taxRate, CreatedAt1 createdAt, UpdatedAt1 updatedAt, CanceledAt canceledAt, Integer limit, Integer offset, String fields, String expand) throws ApiException { - ApiResponse resp = getCustomersCustomerOrdersWithHttpInfo(q, id, status, fulfillmentStatus, paymentStatus, displayId, cartId, email, regionId, currencyCode, taxRate, createdAt, updatedAt, canceledAt, limit, offset, fields, expand); - return resp.getData(); - } - - /** - * List Orders - * Retrieves a list of a Customer's Orders. - * @param q Query used for searching orders. (optional) - * @param id Id of the order to search for. (optional) - * @param status Status to search for. (optional) - * @param fulfillmentStatus Fulfillment status to search for. (optional) - * @param paymentStatus Payment status to search for. (optional) - * @param displayId Display id to search for. (optional) - * @param cartId to search for. (optional) - * @param email to search for. (optional) - * @param regionId to search for. (optional) - * @param currencyCode The 3 character ISO currency code to set prices based on. (optional) - * @param taxRate to search for. (optional) - * @param createdAt Date comparison for when resulting collections were created. (optional) - * @param updatedAt Date comparison for when resulting collections were updated. (optional) - * @param canceledAt Date comparison for when resulting collections were canceled. (optional) - * @param limit How many orders to return. (optional, default to 10) - * @param offset The offset in the resulting orders. (optional, default to 0) - * @param fields (Comma separated string) Which fields should be included in the resulting orders. (optional) - * @param expand (Comma separated string) Which relations should be expanded in the resulting orders. (optional) - * @return ApiResponse<StoreCustomersListOrdersRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getCustomersCustomerOrdersWithHttpInfo(String q, String id, List status, List fulfillmentStatus, List paymentStatus, String displayId, String cartId, String email, String regionId, String currencyCode, String taxRate, CreatedAt1 createdAt, UpdatedAt1 updatedAt, CanceledAt canceledAt, Integer limit, Integer offset, String fields, String expand) throws ApiException { - com.squareup.okhttp.Call call = getCustomersCustomerOrdersValidateBeforeCall(q, id, status, fulfillmentStatus, paymentStatus, displayId, cartId, email, regionId, currencyCode, taxRate, createdAt, updatedAt, canceledAt, limit, offset, fields, expand, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * List Orders (asynchronously) - * Retrieves a list of a Customer's Orders. - * @param q Query used for searching orders. (optional) - * @param id Id of the order to search for. (optional) - * @param status Status to search for. (optional) - * @param fulfillmentStatus Fulfillment status to search for. (optional) - * @param paymentStatus Payment status to search for. (optional) - * @param displayId Display id to search for. (optional) - * @param cartId to search for. (optional) - * @param email to search for. (optional) - * @param regionId to search for. (optional) - * @param currencyCode The 3 character ISO currency code to set prices based on. (optional) - * @param taxRate to search for. (optional) - * @param createdAt Date comparison for when resulting collections were created. (optional) - * @param updatedAt Date comparison for when resulting collections were updated. (optional) - * @param canceledAt Date comparison for when resulting collections were canceled. (optional) - * @param limit How many orders to return. (optional, default to 10) - * @param offset The offset in the resulting orders. (optional, default to 0) - * @param fields (Comma separated string) Which fields should be included in the resulting orders. (optional) - * @param expand (Comma separated string) Which relations should be expanded in the resulting orders. (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getCustomersCustomerOrdersAsync(String q, String id, List status, List fulfillmentStatus, List paymentStatus, String displayId, String cartId, String email, String regionId, String currencyCode, String taxRate, CreatedAt1 createdAt, UpdatedAt1 updatedAt, CanceledAt canceledAt, Integer limit, Integer offset, String fields, String expand, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getCustomersCustomerOrdersValidateBeforeCall(q, id, status, fulfillmentStatus, paymentStatus, displayId, cartId, email, regionId, currencyCode, taxRate, createdAt, updatedAt, canceledAt, limit, offset, fields, expand, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getCustomersCustomerPaymentMethods - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getCustomersCustomerPaymentMethodsCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/customers/me/payment-methods"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getCustomersCustomerPaymentMethodsValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = getCustomersCustomerPaymentMethodsCall(progressListener, progressRequestListener); - return call; - - - - - + public ListOrdersRequest listOrders() throws ApiException { + return new ListOrdersRequest(medusaSdkClient); } /** * Get Payment Methods * Retrieves a list of a Customer's saved payment methods. Payment methods are saved with Payment Providers and it is their responsibility to fetch saved methods. + * * @return StoreCustomersListPaymentMethodsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCustomersListPaymentMethodsRes getCustomersCustomerPaymentMethods() throws ApiException { - ApiResponse resp = getCustomersCustomerPaymentMethodsWithHttpInfo(); - return resp.getData(); - } - - /** - * Get Payment Methods - * Retrieves a list of a Customer's saved payment methods. Payment methods are saved with Payment Providers and it is their responsibility to fetch saved methods. - * @return ApiResponse<StoreCustomersListPaymentMethodsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getCustomersCustomerPaymentMethodsWithHttpInfo() throws ApiException { - com.squareup.okhttp.Call call = getCustomersCustomerPaymentMethodsValidateBeforeCall(null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Get Payment Methods (asynchronously) - * Retrieves a list of a Customer's saved payment methods. Payment methods are saved with Payment Providers and it is their responsibility to fetch saved methods. - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getCustomersCustomerPaymentMethodsAsync(final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getCustomersCustomerPaymentMethodsValidateBeforeCall(progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postCustomers - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postCustomersCall(StorePostCustomersReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/customers"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postCustomersValidateBeforeCall(StorePostCustomersReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = postCustomersCall(body, progressListener, progressRequestListener); - return call; - - - - - + public GetPaymentMethodsRequest getPaymentMethods() throws ApiException { + return new GetPaymentMethodsRequest(medusaSdkClient); } /** * Create a Customer * Creates a Customer account. - * @param body (optional) + * body (optional) + * * @return StoreCustomersRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCustomersRes postCustomers(StorePostCustomersReq body) throws ApiException { - ApiResponse resp = postCustomersWithHttpInfo(body); - return resp.getData(); - } - - /** - * Create a Customer - * Creates a Customer account. - * @param body (optional) - * @return ApiResponse<StoreCustomersRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postCustomersWithHttpInfo(StorePostCustomersReq body) throws ApiException { - com.squareup.okhttp.Call call = postCustomersValidateBeforeCall(body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Create a Customer (asynchronously) - * Creates a Customer account. - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postCustomersAsync(StorePostCustomersReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postCustomersValidateBeforeCall(body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postCustomersCustomer - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postCustomersCustomerCall(StorePostCustomersCustomerReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/customers/me"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postCustomersCustomerValidateBeforeCall(StorePostCustomersCustomerReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = postCustomersCustomerCall(body, progressListener, progressRequestListener); - return call; - - - - - + public CreateCustomerRequest createCustomer() throws ApiException { + return new CreateCustomerRequest(medusaSdkClient); } /** * Update Customer * Updates a Customer's saved details. - * @param body (optional) + * body (optional) + * * @return StoreCustomersRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCustomersRes postCustomersCustomer(StorePostCustomersCustomerReq body) throws ApiException { - ApiResponse resp = postCustomersCustomerWithHttpInfo(body); - return resp.getData(); - } - - /** - * Update Customer - * Updates a Customer's saved details. - * @param body (optional) - * @return ApiResponse<StoreCustomersRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postCustomersCustomerWithHttpInfo(StorePostCustomersCustomerReq body) throws ApiException { - com.squareup.okhttp.Call call = postCustomersCustomerValidateBeforeCall(body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Update Customer (asynchronously) - * Updates a Customer's saved details. - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postCustomersCustomerAsync(StorePostCustomersCustomerReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postCustomersCustomerValidateBeforeCall(body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postCustomersCustomerAddresses - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postCustomersCustomerAddressesCall(StorePostCustomersCustomerAddressesReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/customers/me/addresses"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postCustomersCustomerAddressesValidateBeforeCall(StorePostCustomersCustomerAddressesReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = postCustomersCustomerAddressesCall(body, progressListener, progressRequestListener); - return call; - - - - - + public UpdateCustomerRequest updateCustomer() throws ApiException { + return new UpdateCustomerRequest(medusaSdkClient); } /** * Add a Shipping Address * Adds a Shipping Address to a Customer's saved addresses. - * @param body (optional) + * body (optional) + * * @return StoreCustomersRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCustomersRes postCustomersCustomerAddresses(StorePostCustomersCustomerAddressesReq body) throws ApiException { - ApiResponse resp = postCustomersCustomerAddressesWithHttpInfo(body); - return resp.getData(); - } - - /** - * Add a Shipping Address - * Adds a Shipping Address to a Customer's saved addresses. - * @param body (optional) - * @return ApiResponse<StoreCustomersRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postCustomersCustomerAddressesWithHttpInfo(StorePostCustomersCustomerAddressesReq body) throws ApiException { - com.squareup.okhttp.Call call = postCustomersCustomerAddressesValidateBeforeCall(body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Add a Shipping Address (asynchronously) - * Adds a Shipping Address to a Customer's saved addresses. - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postCustomersCustomerAddressesAsync(StorePostCustomersCustomerAddressesReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postCustomersCustomerAddressesValidateBeforeCall(body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postCustomersCustomerAddressesAddress - * @param addressId The id of the Address to update. (required) - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postCustomersCustomerAddressesAddressCall(String addressId, StorePostCustomersCustomerAddressesAddressReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/customers/me/addresses/{address_id}" - .replaceAll("\\{" + "address_id" + "\\}", medusaSdkClient.escapeString(addressId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postCustomersCustomerAddressesAddressValidateBeforeCall(String addressId, StorePostCustomersCustomerAddressesAddressReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'addressId' is set - if (addressId == null) { - throw new ApiException("Missing the required parameter 'addressId' when calling postCustomersCustomerAddressesAddress(Async)"); - } - - com.squareup.okhttp.Call call = postCustomersCustomerAddressesAddressCall(addressId, body, progressListener, progressRequestListener); - return call; - - - - - + public AddShippingAddress addShippingAddress() throws ApiException { + return new AddShippingAddress(medusaSdkClient); } /** * Update a Shipping Address * Updates a Customer's saved Shipping Address. + * * @param addressId The id of the Address to update. (required) - * @param body (optional) + * body (optional) * @return StoreCustomersRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCustomersRes postCustomersCustomerAddressesAddress(String addressId, StorePostCustomersCustomerAddressesAddressReq body) throws ApiException { - ApiResponse resp = postCustomersCustomerAddressesAddressWithHttpInfo(addressId, body); - return resp.getData(); - } - - /** - * Update a Shipping Address - * Updates a Customer's saved Shipping Address. - * @param addressId The id of the Address to update. (required) - * @param body (optional) - * @return ApiResponse<StoreCustomersRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postCustomersCustomerAddressesAddressWithHttpInfo(String addressId, StorePostCustomersCustomerAddressesAddressReq body) throws ApiException { - com.squareup.okhttp.Call call = postCustomersCustomerAddressesAddressValidateBeforeCall(addressId, body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Update a Shipping Address (asynchronously) - * Updates a Customer's saved Shipping Address. - * @param addressId The id of the Address to update. (required) - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postCustomersCustomerAddressesAddressAsync(String addressId, StorePostCustomersCustomerAddressesAddressReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postCustomersCustomerAddressesAddressValidateBeforeCall(addressId, body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postCustomersCustomerPasswordToken - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postCustomersCustomerPasswordTokenCall(StorePostCustomersCustomerPasswordTokenReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/customers/password-token"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postCustomersCustomerPasswordTokenValidateBeforeCall(StorePostCustomersCustomerPasswordTokenReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = postCustomersCustomerPasswordTokenCall(body, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * Request Password Reset - * Creates a reset password token to be used in a subsequent /reset-password request. The password token should be sent out of band e.g. via email and will not be returned. - * @param body (optional) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void postCustomersCustomerPasswordToken(StorePostCustomersCustomerPasswordTokenReq body) throws ApiException { - postCustomersCustomerPasswordTokenWithHttpInfo(body); + public UpdateShippingAddressRequest updateShippingAddress(String addressId) throws ApiException { + return new UpdateShippingAddressRequest(medusaSdkClient, addressId); } /** * Request Password Reset * Creates a reset password token to be used in a subsequent /reset-password request. The password token should be sent out of band e.g. via email and will not be returned. - * @param body (optional) - * @return ApiResponse<Void> + * body (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public ApiResponse postCustomersCustomerPasswordTokenWithHttpInfo(StorePostCustomersCustomerPasswordTokenReq body) throws ApiException { - com.squareup.okhttp.Call call = postCustomersCustomerPasswordTokenValidateBeforeCall(body, null, null); - return medusaSdkClient.execute(call); - } - - /** - * Request Password Reset (asynchronously) - * Creates a reset password token to be used in a subsequent /reset-password request. The password token should be sent out of band e.g. via email and will not be returned. - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postCustomersCustomerPasswordTokenAsync(StorePostCustomersCustomerPasswordTokenReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postCustomersCustomerPasswordTokenValidateBeforeCall(body, progressListener, progressRequestListener); - medusaSdkClient.executeAsync(call, callback); - return call; - } - /** - * Build call for postCustomersResetPassword - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postCustomersResetPasswordCall(StorePostCustomersResetPasswordReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/customers/password-reset"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + public PasswordResetRequest passwordResetRequest() throws ApiException { + return new PasswordResetRequest(medusaSdkClient); } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postCustomersResetPasswordValidateBeforeCall(StorePostCustomersResetPasswordReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = postCustomersResetPasswordCall(body, progressListener, progressRequestListener); - return call; - - - - - } /** * Reset Password * Resets a Customer's password using a password token created by a previous /password-token request. - * @param body (optional) + * body (optional) * @return StoreCustomersRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreCustomersRes postCustomersResetPassword(StorePostCustomersResetPasswordReq body) throws ApiException { - ApiResponse resp = postCustomersResetPasswordWithHttpInfo(body); - return resp.getData(); - } - - /** - * Reset Password - * Resets a Customer's password using a password token created by a previous /password-token request. - * @param body (optional) - * @return ApiResponse<StoreCustomersRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postCustomersResetPasswordWithHttpInfo(StorePostCustomersResetPasswordReq body) throws ApiException { - com.squareup.okhttp.Call call = postCustomersResetPasswordValidateBeforeCall(body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); + public ResetPasswordRequest resetPassword() throws ApiException { + return new ResetPasswordRequest(medusaSdkClient); } - /** - * Reset Password (asynchronously) - * Resets a Customer's password using a password token created by a previous /password-token request. - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postCustomersResetPasswordAsync(StorePostCustomersResetPasswordReq body, final ApiCallback callback) throws ApiException { - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postCustomersResetPasswordValidateBeforeCall(body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } } diff --git a/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java b/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java index 45376d4..3b965b0 100644 --- a/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java +++ b/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java @@ -8,4 +8,19 @@ public class QueryParamConstant { public static final String LIMIT = "limit"; public static final String CREATED_AT = "created_at"; public static final String UPDATED_AT = "updated_at"; + public static final String Q = "q"; + public static final String ID = "id"; + public static final String CSV_FORMAT = "csv"; + public static final String STATUS = "status"; + public static final String FULFILLMENT_STATUS = "fulfillment_status"; + public static final String PAYMENT_STATUS = "payment_status"; + public static final String DISPLAY_ID = "display_id"; + public static final String CART_ID = "cart_id"; + public static final String EMAIL = "email"; + public static final String REGION_ID = "region_id"; + public static final String CURRENCY_CODE = "currency_code"; + public static final String TAX_RATE = "tax_rate"; + public static final String CANCELED_AT = "canceled_at"; + public static final String FIELDS = "fields"; + public static final String EXPAND = "expand"; } diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/AddShippingAddress.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/AddShippingAddress.java new file mode 100644 index 0000000..c26526a --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/AddShippingAddress.java @@ -0,0 +1,57 @@ +package mobi.appcent.medusa.store.model.request.customer; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCustomersRes; +import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerAddressesReq; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by erenalpaslan on 9.03.2023 + */ +public class AddShippingAddress extends BaseRequest { + + private final MedusaSdkClient client; + private StorePostCustomersCustomerAddressesReq body; + + public AddShippingAddress(MedusaSdkClient client) { + this.client = client; + } + + public AddShippingAddress body(StorePostCustomersCustomerAddressesReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.CUSTOMER_PATH + "/me/addresses"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/CreateCustomerRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/CreateCustomerRequest.java new file mode 100644 index 0000000..da91fd9 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/CreateCustomerRequest.java @@ -0,0 +1,57 @@ +package mobi.appcent.medusa.store.model.request.customer; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCustomersRes; +import mobi.appcent.medusa.store.model.response.StorePostCustomersReq; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by erenalpaslan on 9.03.2023 + */ +public class CreateCustomerRequest extends BaseRequest { + + private final MedusaSdkClient client; + private StorePostCustomersReq body; + + public CreateCustomerRequest(MedusaSdkClient client) { + this.client = client; + } + + public CreateCustomerRequest body(StorePostCustomersReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.CUSTOMER_PATH; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/DeleteAddressRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/DeleteAddressRequest.java new file mode 100644 index 0000000..09d3a36 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/DeleteAddressRequest.java @@ -0,0 +1,56 @@ +package mobi.appcent.medusa.store.model.request.customer; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCustomersRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 9.03.2023 + */ +public class DeleteAddressRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String addressId; + + public DeleteAddressRequest(MedusaSdkClient client, String addressId) { + this.client = client; + this.addressId = addressId; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.CUSTOMER_PATH + "/me/addresses/" + addressId; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.DELETE, null, null, null, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/GetCustomerRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/GetCustomerRequest.java new file mode 100644 index 0000000..37c5f46 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/GetCustomerRequest.java @@ -0,0 +1,54 @@ +package mobi.appcent.medusa.store.model.request.customer; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCustomersRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 9.03.2023 + */ +public class GetCustomerRequest extends BaseRequest { + + private final MedusaSdkClient client; + + public GetCustomerRequest(MedusaSdkClient client) { + this.client = client; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.CUSTOMER_PATH + "/me"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/GetPaymentMethodsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/GetPaymentMethodsRequest.java new file mode 100644 index 0000000..20c0ceb --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/GetPaymentMethodsRequest.java @@ -0,0 +1,51 @@ +package mobi.appcent.medusa.store.model.request.customer; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCustomersListPaymentMethodsRes; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by erenalpaslan on 9.03.2023 + */ +public class GetPaymentMethodsRequest extends BaseRequest { + + private final MedusaSdkClient client; + + public GetPaymentMethodsRequest(MedusaSdkClient client) { + this.client = client; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.CUSTOMER_PATH + "/me/payment-methods"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/ListOrdersRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/ListOrdersRequest.java new file mode 100644 index 0000000..127f8fa --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/ListOrdersRequest.java @@ -0,0 +1,204 @@ +package mobi.appcent.medusa.store.model.request.customer; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.QueryParamConstant; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.CanceledAt; +import mobi.appcent.medusa.store.model.response.CreatedAt1; +import mobi.appcent.medusa.store.model.response.StoreCustomersListOrdersRes; +import mobi.appcent.medusa.store.model.response.UpdatedAt1; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 9.03.2023 + */ +public class ListOrdersRequest extends BaseRequest { + + private final MedusaSdkClient client; + private String q; + private String id; + private List status; + private List fulfillmentStatus; + private List paymentStatus; + private String displayId; + private String cartId; + private String email; + private String regionId; + private String currencyCode; + private String taxRate; + private CreatedAt1 createdAt; + private UpdatedAt1 updatedAt; + private CanceledAt canceledAt; + private Integer limit; + private Integer offset; + private String fields; + private String expand; + + public ListOrdersRequest(MedusaSdkClient client) { + this.client = client; + } + + public ListOrdersRequest q(String q) { + this.q = q; + return this; + } + + public ListOrdersRequest id(String id) { + this.id = id; + return this; + } + + public ListOrdersRequest status(List status) { + this.status = status; + return this; + } + + public ListOrdersRequest fulfillmentStatus(List fulfillmentStatus) { + this.fulfillmentStatus = fulfillmentStatus; + return this; + } + + public ListOrdersRequest paymentStatus(List paymentStatus) { + this.paymentStatus = paymentStatus; + return this; + } + + public ListOrdersRequest displayId(String displayId) { + this.displayId = displayId; + return this; + } + + public ListOrdersRequest cartId(String cartId) { + this.cartId = cartId; + return this; + } + + public ListOrdersRequest email(String email) { + this.email = email; + return this; + } + + public ListOrdersRequest regionId(String regionId) { + this.regionId = regionId; + return this; + } + + public ListOrdersRequest currencyCode(String currencyCode) { + this.currencyCode = currencyCode; + return this; + } + + public ListOrdersRequest taxRate(String taxRate) { + this.taxRate = taxRate; + return this; + } + + public ListOrdersRequest createdAt(CreatedAt1 createdAt) { + this.createdAt = createdAt; + return this; + } + + public ListOrdersRequest updatedAt(UpdatedAt1 updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public ListOrdersRequest canceledAt(CanceledAt canceledAt) { + this.canceledAt = canceledAt; + return this; + } + + public ListOrdersRequest limit(Integer limit) { + this.limit = limit; + return this; + } + + public ListOrdersRequest offset(Integer offset) { + this.offset = offset; + return this; + } + + public ListOrdersRequest fields(String fields) { + this.fields = fields; + return this; + } + + public ListOrdersRequest expand(String expand) { + this.expand = expand; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.CUSTOMER_PATH + "/me/orders"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (q != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.Q, q)); + if (id != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.ID, id)); + if (status != null) + localVarCollectionQueryParams.addAll(client.parameterToPairs(QueryParamConstant.CSV_FORMAT, QueryParamConstant.STATUS, status)); + if (fulfillmentStatus != null) + localVarCollectionQueryParams.addAll(client.parameterToPairs(QueryParamConstant.CSV_FORMAT, QueryParamConstant.FULFILLMENT_STATUS, fulfillmentStatus)); + if (paymentStatus != null) + localVarCollectionQueryParams.addAll(client.parameterToPairs(QueryParamConstant.CSV_FORMAT, QueryParamConstant.PAYMENT_STATUS, paymentStatus)); + if (displayId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.DISPLAY_ID, displayId)); + if (cartId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CART_ID, cartId)); + if (email != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.EMAIL, email)); + if (regionId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.REGION_ID, regionId)); + if (currencyCode != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CURRENCY_CODE, currencyCode)); + if (taxRate != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.TAX_RATE, taxRate)); + if (createdAt != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CREATED_AT, createdAt)); + if (updatedAt != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.UPDATED_AT, updatedAt)); + if (canceledAt != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CANCELED_AT, canceledAt)); + if (limit != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.LIMIT, limit)); + if (offset != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.OFFSET, offset)); + if (fields != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.FIELDS, fields)); + if (expand != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.EXPAND, expand)); + + + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, localVarCollectionQueryParams, null, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/PasswordResetRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/PasswordResetRequest.java new file mode 100644 index 0000000..e788e33 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/PasswordResetRequest.java @@ -0,0 +1,59 @@ +package mobi.appcent.medusa.store.model.request.customer; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerPasswordTokenReq; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 9.03.2023 + */ +public class PasswordResetRequest extends BaseRequest { + + private final MedusaSdkClient client; + private StorePostCustomersCustomerPasswordTokenReq body; + + public PasswordResetRequest(MedusaSdkClient client) { + this.client = client; + } + + public PasswordResetRequest body(StorePostCustomersCustomerPasswordTokenReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.CUSTOMER_PATH + "/password-token"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/ResetPasswordRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/ResetPasswordRequest.java new file mode 100644 index 0000000..8c03f37 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/ResetPasswordRequest.java @@ -0,0 +1,60 @@ +package mobi.appcent.medusa.store.model.request.customer; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCustomersRes; +import mobi.appcent.medusa.store.model.response.StorePostCustomersResetPasswordReq; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 9.03.2023 + */ +public class ResetPasswordRequest extends BaseRequest { + + private final MedusaSdkClient client; + private StorePostCustomersResetPasswordReq body; + + public ResetPasswordRequest(MedusaSdkClient client) { + this.client = client; + } + + public ResetPasswordRequest body(StorePostCustomersResetPasswordReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.CUSTOMER_PATH + "/password-reset"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/UpdateCustomerRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/UpdateCustomerRequest.java new file mode 100644 index 0000000..25aa00a --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/UpdateCustomerRequest.java @@ -0,0 +1,61 @@ +package mobi.appcent.medusa.store.model.request.customer; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCustomersRes; +import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerReq; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 9.03.2023 + */ +public class UpdateCustomerRequest extends BaseRequest { + + private final MedusaSdkClient client; + private StorePostCustomersCustomerReq body; + + public UpdateCustomerRequest(MedusaSdkClient client) { + this.client = client; + } + + public UpdateCustomerRequest body(StorePostCustomersCustomerReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.CUSTOMER_PATH + "/me"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/UpdateShippingAddressRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/UpdateShippingAddressRequest.java new file mode 100644 index 0000000..3593387 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/UpdateShippingAddressRequest.java @@ -0,0 +1,60 @@ +package mobi.appcent.medusa.store.model.request.customer; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreCustomersRes; +import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerAddressesAddressReq; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by erenalpaslan on 9.03.2023 + */ +public class UpdateShippingAddressRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String addressId; + private StorePostCustomersCustomerAddressesAddressReq body; + + public UpdateShippingAddressRequest(MedusaSdkClient client, String addressId) { + this.client = client; + this.addressId = addressId; + } + + public UpdateShippingAddressRequest body(StorePostCustomersCustomerAddressesAddressReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.CUSTOMER_PATH + "/me/addresses/" + addressId; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/test/java/mobi/appcent/medusa/store/api/CustomerApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/CustomerApiTest.java index f32b3cd..f22447b 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/CustomerApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/CustomerApiTest.java @@ -50,7 +50,7 @@ public class CustomerApiTest { @Test public void deleteCustomersCustomerAddressesAddressTest() throws Exception { String addressId = null; - StoreCustomersRes response = api.deleteCustomersCustomerAddressesAddress(addressId); + StoreCustomersRes response = api.deleteAddressRequest(addressId).execute().getData(); // TODO: test validations } @@ -64,7 +64,7 @@ public void deleteCustomersCustomerAddressesAddressTest() throws Exception { */ @Test public void getCustomersCustomerTest() throws Exception { - StoreCustomersRes response = api.getCustomersCustomer(); + StoreCustomersRes response = api.getCustomer().execute().getData(); // TODO: test validations } @@ -96,7 +96,7 @@ public void getCustomersCustomerOrdersTest() throws Exception { Integer offset = null; String fields = null; String expand = null; - StoreCustomersListOrdersRes response = api.getCustomersCustomerOrders(q, id, status, fulfillmentStatus, paymentStatus, displayId, cartId, email, regionId, currencyCode, taxRate, createdAt, updatedAt, canceledAt, limit, offset, fields, expand); + StoreCustomersListOrdersRes response = api.listOrders().execute().getData(); // TODO: test validations } @@ -110,7 +110,7 @@ public void getCustomersCustomerOrdersTest() throws Exception { */ @Test public void getCustomersCustomerPaymentMethodsTest() throws Exception { - StoreCustomersListPaymentMethodsRes response = api.getCustomersCustomerPaymentMethods(); + StoreCustomersListPaymentMethodsRes response = api.getPaymentMethods().execute().getData(); // TODO: test validations } @@ -125,7 +125,7 @@ public void getCustomersCustomerPaymentMethodsTest() throws Exception { @Test public void postCustomersTest() throws Exception { StorePostCustomersReq body = null; - StoreCustomersRes response = api.postCustomers(body); + StoreCustomersRes response = api.createCustomer().execute().getData(); // TODO: test validations } @@ -140,7 +140,7 @@ public void postCustomersTest() throws Exception { @Test public void postCustomersCustomerTest() throws Exception { StorePostCustomersCustomerReq body = null; - StoreCustomersRes response = api.postCustomersCustomer(body); + StoreCustomersRes response = api.updateCustomer().execute().getData(); // TODO: test validations } @@ -155,7 +155,7 @@ public void postCustomersCustomerTest() throws Exception { @Test public void postCustomersCustomerAddressesTest() throws Exception { StorePostCustomersCustomerAddressesReq body = null; - StoreCustomersRes response = api.postCustomersCustomerAddresses(body); + StoreCustomersRes response = api.addShippingAddress().execute().getData(); // TODO: test validations } @@ -171,7 +171,7 @@ public void postCustomersCustomerAddressesTest() throws Exception { public void postCustomersCustomerAddressesAddressTest() throws Exception { String addressId = null; StorePostCustomersCustomerAddressesAddressReq body = null; - StoreCustomersRes response = api.postCustomersCustomerAddressesAddress(addressId, body); + StoreCustomersRes response = api.updateShippingAddress(addressId).execute().getData(); // TODO: test validations } @@ -186,7 +186,7 @@ public void postCustomersCustomerAddressesAddressTest() throws Exception { @Test public void postCustomersCustomerPasswordTokenTest() throws Exception { StorePostCustomersCustomerPasswordTokenReq body = null; - api.postCustomersCustomerPasswordToken(body); + api.passwordResetRequest().execute(); // TODO: test validations } @@ -201,7 +201,7 @@ public void postCustomersCustomerPasswordTokenTest() throws Exception { @Test public void postCustomersResetPasswordTest() throws Exception { StorePostCustomersResetPasswordReq body = null; - StoreCustomersRes response = api.postCustomersResetPassword(body); + StoreCustomersRes response = api.resetPassword().execute().getData(); // TODO: test validations } From 5118b6f21fe5532b27054357b2cc759aafe1d1fd Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Thu, 9 Mar 2023 22:22:45 +0300 Subject: [PATCH 05/32] feat(invite-api): Refactor invite api (#5) --- .../appcent/medusa/store/api/InviteApi.java | 114 +----------------- .../request/invite/ClaimOrderRequest.java | 61 ++++++++++ 2 files changed, 65 insertions(+), 110 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/invite/ClaimOrderRequest.java diff --git a/src/main/java/mobi/appcent/medusa/store/api/InviteApi.java b/src/main/java/mobi/appcent/medusa/store/api/InviteApi.java index c04e33c..a52650d 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/InviteApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/InviteApi.java @@ -18,6 +18,7 @@ import java.io.IOException; +import mobi.appcent.medusa.store.model.request.invite.ClaimOrderRequest; import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerOrderClaimReq; import java.util.ArrayList; @@ -38,122 +39,15 @@ public MedusaSdkClient getApiClient() { public void setApiClient(MedusaSdkClient medusaSdkClient) { this.medusaSdkClient = medusaSdkClient; - } - - /** - * Build call for postOrdersCustomerOrderClaim - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postOrdersCustomerOrderClaimCall(StorePostCustomersCustomerOrderClaimReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/orders/batch/customer/token"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postOrdersCustomerOrderClaimValidateBeforeCall(StorePostCustomersCustomerOrderClaimReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = postOrdersCustomerOrderClaimCall(body, progressListener, progressRequestListener); - return call; - - - - - } /** * Claim an Order * Sends an email to emails registered to orders provided with link to transfer order ownership - * @param body (optional) + * body (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public void postOrdersCustomerOrderClaim(StorePostCustomersCustomerOrderClaimReq body) throws ApiException { - postOrdersCustomerOrderClaimWithHttpInfo(body); - } - - /** - * Claim an Order - * Sends an email to emails registered to orders provided with link to transfer order ownership - * @param body (optional) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postOrdersCustomerOrderClaimWithHttpInfo(StorePostCustomersCustomerOrderClaimReq body) throws ApiException { - com.squareup.okhttp.Call call = postOrdersCustomerOrderClaimValidateBeforeCall(body, null, null); - return medusaSdkClient.execute(call); - } - - /** - * Claim an Order (asynchronously) - * Sends an email to emails registered to orders provided with link to transfer order ownership - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postOrdersCustomerOrderClaimAsync(StorePostCustomersCustomerOrderClaimReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postOrdersCustomerOrderClaimValidateBeforeCall(body, progressListener, progressRequestListener); - medusaSdkClient.executeAsync(call, callback); - return call; + public ClaimOrderRequest claimOrder() throws ApiException { + return new ClaimOrderRequest(medusaSdkClient); } } diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/invite/ClaimOrderRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/invite/ClaimOrderRequest.java new file mode 100644 index 0000000..a9c8477 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/invite/ClaimOrderRequest.java @@ -0,0 +1,61 @@ +package mobi.appcent.medusa.store.model.request.invite; + +import com.squareup.okhttp.Call; +import jdk.javadoc.internal.doclets.formats.html.markup.Head; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerOrderClaimReq; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 9.03.2023 + */ +public class ClaimOrderRequest extends BaseRequest { + + private final MedusaSdkClient client; + private StorePostCustomersCustomerOrderClaimReq body; + + public ClaimOrderRequest(MedusaSdkClient client) { + this.client = client; + } + + public ClaimOrderRequest body(StorePostCustomersCustomerOrderClaimReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.ORDER_PATH + "/batch/customer/token"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN}; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} From 2440e149d9ba83850eaf1d733c60bb6d0068e8d6 Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Thu, 9 Mar 2023 22:23:27 +0300 Subject: [PATCH 06/32] Feature/gift card api (#6) * feat(gift-card-api): Refactor gift cards api * fix(gift-card-api): Corrects path --- .../appcent/medusa/store/api/GiftCardApi.java | 120 +----------------- .../giftcard/GetGiftCardByCodeRequest.java | 55 ++++++++ .../medusa/store/api/GiftCardApiTest.java | 2 +- 3 files changed, 59 insertions(+), 118 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/giftcard/GetGiftCardByCodeRequest.java diff --git a/src/main/java/mobi/appcent/medusa/store/api/GiftCardApi.java b/src/main/java/mobi/appcent/medusa/store/api/GiftCardApi.java index e402fa8..39ef61e 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/GiftCardApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/GiftCardApi.java @@ -20,6 +20,7 @@ import java.io.IOException; +import mobi.appcent.medusa.store.model.request.giftcard.GetGiftCardByCodeRequest; import mobi.appcent.medusa.store.model.response.StoreGiftCardsRes; import java.lang.reflect.Type; @@ -41,72 +42,6 @@ public MedusaSdkClient getApiClient() { public void setApiClient(MedusaSdkClient medusaSdkClient) { this.medusaSdkClient = medusaSdkClient; - } - - /** - * Build call for getGiftCardsCode - * @param code The unique Gift Card code. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getGiftCardsCodeCall(String code, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/gift-cards/{code}" - .replaceAll("\\{" + "code" + "\\}", medusaSdkClient.escapeString(code.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getGiftCardsCodeValidateBeforeCall(String code, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'code' is set - if (code == null) { - throw new ApiException("Missing the required parameter 'code' when calling getGiftCardsCode(Async)"); - } - - com.squareup.okhttp.Call call = getGiftCardsCodeCall(code, progressListener, progressRequestListener); - return call; - - - - - } /** @@ -116,56 +51,7 @@ private com.squareup.okhttp.Call getGiftCardsCodeValidateBeforeCall(String code, * @return StoreGiftCardsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreGiftCardsRes getGiftCardsCode(String code) throws ApiException { - ApiResponse resp = getGiftCardsCodeWithHttpInfo(code); - return resp.getData(); - } - - /** - * Get Gift Card by Code - * Retrieves a Gift Card by its associated unique code. - * @param code The unique Gift Card code. (required) - * @return ApiResponse<StoreGiftCardsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getGiftCardsCodeWithHttpInfo(String code) throws ApiException { - com.squareup.okhttp.Call call = getGiftCardsCodeValidateBeforeCall(code, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Get Gift Card by Code (asynchronously) - * Retrieves a Gift Card by its associated unique code. - * @param code The unique Gift Card code. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getGiftCardsCodeAsync(String code, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getGiftCardsCodeValidateBeforeCall(code, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; + public GetGiftCardByCodeRequest getGiftCardByCode(String code) throws ApiException { + return new GetGiftCardByCodeRequest(medusaSdkClient, code); } } diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/giftcard/GetGiftCardByCodeRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/giftcard/GetGiftCardByCodeRequest.java new file mode 100644 index 0000000..440ad94 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/giftcard/GetGiftCardByCodeRequest.java @@ -0,0 +1,55 @@ +package mobi.appcent.medusa.store.model.request.giftcard; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreGiftCardsRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 9.03.2023 + */ +public class GetGiftCardByCodeRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String code; + + public GetGiftCardByCodeRequest(MedusaSdkClient client, String code) { + this.client = client; + this.code = code; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.GIFT_CARD_PATH + "/" + code; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/test/java/mobi/appcent/medusa/store/api/GiftCardApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/GiftCardApiTest.java index 050bb14..f615db3 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/GiftCardApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/GiftCardApiTest.java @@ -36,7 +36,7 @@ public class GiftCardApiTest { @Test public void getGiftCardsCodeTest() throws Exception { String code = null; - StoreGiftCardsRes response = api.getGiftCardsCode(code); + StoreGiftCardsRes response = api.getGiftCardByCode(code).execute().getData(); // TODO: test validations } From 7f5feaa0465bb42f27070a33c69293c12683d5c5 Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Thu, 9 Mar 2023 22:24:55 +0300 Subject: [PATCH 07/32] feat(order-api): Refactor orders api (#7) --- .../appcent/medusa/store/api/OrderApi.java | 516 +----------------- .../store/common/QueryParamConstant.java | 1 + .../order/GetOrderByCartIdRequest.java | 56 ++ .../model/request/order/GetOrderRequest.java | 76 +++ .../order/LookUpOrderByFiltersRequest.java | 90 +++ .../order/VerifyOrderClaimRequest.java | 60 ++ .../medusa/store/api/OrderApiTest.java | 8 +- 7 files changed, 305 insertions(+), 502 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderByCartIdRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/order/LookUpOrderByFiltersRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/order/VerifyOrderClaimRequest.java diff --git a/src/main/java/mobi/appcent/medusa/store/api/OrderApi.java b/src/main/java/mobi/appcent/medusa/store/api/OrderApi.java index ef8889c..1bf3a18 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/OrderApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/OrderApi.java @@ -21,6 +21,10 @@ import java.math.BigDecimal; +import mobi.appcent.medusa.store.model.request.order.GetOrderByCartIdRequest; +import mobi.appcent.medusa.store.model.request.order.GetOrderRequest; +import mobi.appcent.medusa.store.model.request.order.LookUpOrderByFiltersRequest; +import mobi.appcent.medusa.store.model.request.order.VerifyOrderClaimRequest; import mobi.appcent.medusa.store.model.response.ShippingAddress; import mobi.appcent.medusa.store.model.response.StoreOrdersRes; import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerAcceptClaimReq; @@ -44,89 +48,6 @@ public MedusaSdkClient getApiClient() { public void setApiClient(MedusaSdkClient medusaSdkClient) { this.medusaSdkClient = medusaSdkClient; - } - - /** - * Build call for getOrders - * @param displayId The display id given to the Order. (required) - * @param email The email associated with this order. (required) - * @param fields (Comma separated) Which fields should be included in the result. (optional) - * @param expand (Comma separated) Which fields should be expanded in the result. (optional) - * @param shippingAddress The shipping address associated with this order. (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getOrdersCall(BigDecimal displayId, String email, String fields, String expand, ShippingAddress shippingAddress, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/orders"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - if (displayId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("display_id", displayId)); - if (fields != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("fields", fields)); - if (expand != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("expand", expand)); - if (email != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("email", email)); - if (shippingAddress != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("shipping_address", shippingAddress)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getOrdersValidateBeforeCall(BigDecimal displayId, String email, String fields, String expand, ShippingAddress shippingAddress, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'displayId' is set - if (displayId == null) { - throw new ApiException("Missing the required parameter 'displayId' when calling getOrders(Async)"); - } - // verify the required parameter 'email' is set - if (email == null) { - throw new ApiException("Missing the required parameter 'email' when calling getOrders(Async)"); - } - - com.squareup.okhttp.Call call = getOrdersCall(displayId, email, fields, expand, shippingAddress, progressListener, progressRequestListener); - return call; - - - - - } /** @@ -134,273 +55,27 @@ private com.squareup.okhttp.Call getOrdersValidateBeforeCall(BigDecimal displayI * Look up an order using filters. * @param displayId The display id given to the Order. (required) * @param email The email associated with this order. (required) - * @param fields (Comma separated) Which fields should be included in the result. (optional) - * @param expand (Comma separated) Which fields should be expanded in the result. (optional) - * @param shippingAddress The shipping address associated with this order. (optional) + * fields (Comma separated) Which fields should be included in the result. (optional) + * expand (Comma separated) Which fields should be expanded in the result. (optional) + * shippingAddress The shipping address associated with this order. (optional) * @return StoreOrdersRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreOrdersRes getOrders(BigDecimal displayId, String email, String fields, String expand, ShippingAddress shippingAddress) throws ApiException { - ApiResponse resp = getOrdersWithHttpInfo(displayId, email, fields, expand, shippingAddress); - return resp.getData(); - } - - /** - * Look Up an Order - * Look up an order using filters. - * @param displayId The display id given to the Order. (required) - * @param email The email associated with this order. (required) - * @param fields (Comma separated) Which fields should be included in the result. (optional) - * @param expand (Comma separated) Which fields should be expanded in the result. (optional) - * @param shippingAddress The shipping address associated with this order. (optional) - * @return ApiResponse<StoreOrdersRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getOrdersWithHttpInfo(BigDecimal displayId, String email, String fields, String expand, ShippingAddress shippingAddress) throws ApiException { - com.squareup.okhttp.Call call = getOrdersValidateBeforeCall(displayId, email, fields, expand, shippingAddress, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Look Up an Order (asynchronously) - * Look up an order using filters. - * @param displayId The display id given to the Order. (required) - * @param email The email associated with this order. (required) - * @param fields (Comma separated) Which fields should be included in the result. (optional) - * @param expand (Comma separated) Which fields should be expanded in the result. (optional) - * @param shippingAddress The shipping address associated with this order. (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getOrdersAsync(BigDecimal displayId, String email, String fields, String expand, ShippingAddress shippingAddress, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getOrdersValidateBeforeCall(displayId, email, fields, expand, shippingAddress, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getOrdersOrder - * @param id The id of the Order. (required) - * @param fields (Comma separated) Which fields should be included in the result. (optional) - * @param expand (Comma separated) Which fields should be expanded in the result. (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getOrdersOrderCall(String id, String fields, String expand, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/orders/{id}" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - if (fields != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("fields", fields)); - if (expand != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("expand", expand)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getOrdersOrderValidateBeforeCall(String id, String fields, String expand, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling getOrdersOrder(Async)"); - } - - com.squareup.okhttp.Call call = getOrdersOrderCall(id, fields, expand, progressListener, progressRequestListener); - return call; - - - - - + public LookUpOrderByFiltersRequest getOrder(BigDecimal displayId, String email) throws ApiException { + return new LookUpOrderByFiltersRequest(medusaSdkClient, displayId, email); } /** * Get an Order * Retrieves an Order * @param id The id of the Order. (required) - * @param fields (Comma separated) Which fields should be included in the result. (optional) - * @param expand (Comma separated) Which fields should be expanded in the result. (optional) + * fields (Comma separated) Which fields should be included in the result. (optional) + * expand (Comma separated) Which fields should be expanded in the result. (optional) * @return StoreOrdersRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreOrdersRes getOrdersOrder(String id, String fields, String expand) throws ApiException { - ApiResponse resp = getOrdersOrderWithHttpInfo(id, fields, expand); - return resp.getData(); - } - - /** - * Get an Order - * Retrieves an Order - * @param id The id of the Order. (required) - * @param fields (Comma separated) Which fields should be included in the result. (optional) - * @param expand (Comma separated) Which fields should be expanded in the result. (optional) - * @return ApiResponse<StoreOrdersRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getOrdersOrderWithHttpInfo(String id, String fields, String expand) throws ApiException { - com.squareup.okhttp.Call call = getOrdersOrderValidateBeforeCall(id, fields, expand, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Get an Order (asynchronously) - * Retrieves an Order - * @param id The id of the Order. (required) - * @param fields (Comma separated) Which fields should be included in the result. (optional) - * @param expand (Comma separated) Which fields should be expanded in the result. (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getOrdersOrderAsync(String id, String fields, String expand, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getOrdersOrderValidateBeforeCall(id, fields, expand, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getOrdersOrderCartId - * @param cartId The ID of Cart. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getOrdersOrderCartIdCall(String cartId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/orders/cart/{cart_id}" - .replaceAll("\\{" + "cart_id" + "\\}", medusaSdkClient.escapeString(cartId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getOrdersOrderCartIdValidateBeforeCall(String cartId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'cartId' is set - if (cartId == null) { - throw new ApiException("Missing the required parameter 'cartId' when calling getOrdersOrderCartId(Async)"); - } - - com.squareup.okhttp.Call call = getOrdersOrderCartIdCall(cartId, progressListener, progressRequestListener); - return call; - - - - - + public GetOrderRequest getOrder(String id) throws ApiException { + return new GetOrderRequest(medusaSdkClient, id); } /** @@ -410,172 +85,17 @@ private com.squareup.okhttp.Call getOrdersOrderCartIdValidateBeforeCall(String c * @return StoreOrdersRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreOrdersRes getOrdersOrderCartId(String cartId) throws ApiException { - ApiResponse resp = getOrdersOrderCartIdWithHttpInfo(cartId); - return resp.getData(); - } - - /** - * Get by Cart ID - * Retrieves an Order by the id of the Cart that was used to create the Order. - * @param cartId The ID of Cart. (required) - * @return ApiResponse<StoreOrdersRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getOrdersOrderCartIdWithHttpInfo(String cartId) throws ApiException { - com.squareup.okhttp.Call call = getOrdersOrderCartIdValidateBeforeCall(cartId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Get by Cart ID (asynchronously) - * Retrieves an Order by the id of the Cart that was used to create the Order. - * @param cartId The ID of Cart. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getOrdersOrderCartIdAsync(String cartId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getOrdersOrderCartIdValidateBeforeCall(cartId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postOrdersCustomerOrderClaimsCustomerOrderClaimAccept - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postOrdersCustomerOrderClaimsCustomerOrderClaimAcceptCall(StorePostCustomersCustomerAcceptClaimReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/orders/customer/confirm"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postOrdersCustomerOrderClaimsCustomerOrderClaimAcceptValidateBeforeCall(StorePostCustomersCustomerAcceptClaimReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = postOrdersCustomerOrderClaimsCustomerOrderClaimAcceptCall(body, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * Verify an Order Claim - * Verifies the claim order token provided to the customer upon request of order ownership - * @param body (optional) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void postOrdersCustomerOrderClaimsCustomerOrderClaimAccept(StorePostCustomersCustomerAcceptClaimReq body) throws ApiException { - postOrdersCustomerOrderClaimsCustomerOrderClaimAcceptWithHttpInfo(body); + public GetOrderByCartIdRequest getOrderByCartId(String cartId) throws ApiException { + return new GetOrderByCartIdRequest(medusaSdkClient, cartId); } /** * Verify an Order Claim * Verifies the claim order token provided to the customer upon request of order ownership - * @param body (optional) - * @return ApiResponse<Void> + * body (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public ApiResponse postOrdersCustomerOrderClaimsCustomerOrderClaimAcceptWithHttpInfo(StorePostCustomersCustomerAcceptClaimReq body) throws ApiException { - com.squareup.okhttp.Call call = postOrdersCustomerOrderClaimsCustomerOrderClaimAcceptValidateBeforeCall(body, null, null); - return medusaSdkClient.execute(call); - } - - /** - * Verify an Order Claim (asynchronously) - * Verifies the claim order token provided to the customer upon request of order ownership - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postOrdersCustomerOrderClaimsCustomerOrderClaimAcceptAsync(StorePostCustomersCustomerAcceptClaimReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postOrdersCustomerOrderClaimsCustomerOrderClaimAcceptValidateBeforeCall(body, progressListener, progressRequestListener); - medusaSdkClient.executeAsync(call, callback); - return call; + public VerifyOrderClaimRequest verifyOrderClaim() throws ApiException { + return new VerifyOrderClaimRequest(medusaSdkClient); } } diff --git a/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java b/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java index 3b965b0..443788f 100644 --- a/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java +++ b/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java @@ -8,6 +8,7 @@ public class QueryParamConstant { public static final String LIMIT = "limit"; public static final String CREATED_AT = "created_at"; public static final String UPDATED_AT = "updated_at"; + public static final String SHIPPING_ADDRESS = "shipping_address"; public static final String Q = "q"; public static final String ID = "id"; public static final String CSV_FORMAT = "csv"; diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderByCartIdRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderByCartIdRequest.java new file mode 100644 index 0000000..453325b --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderByCartIdRequest.java @@ -0,0 +1,56 @@ +package mobi.appcent.medusa.store.model.request.order; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.QueryParamConstant; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreOrdersRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 9.03.2023 + */ +public class GetOrderByCartIdRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String cartId; + + public GetOrderByCartIdRequest(MedusaSdkClient client, String cartId) { + this.client = client; + this.cartId = cartId; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.ORDER_PATH + "/cart/" + cartId; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderRequest.java new file mode 100644 index 0000000..2c52f16 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderRequest.java @@ -0,0 +1,76 @@ +package mobi.appcent.medusa.store.model.request.order; + +import com.squareup.okhttp.Call; +import jdk.javadoc.internal.doclets.formats.html.markup.Head; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.QueryParamConstant; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreOrdersRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 9.03.2023 + */ +public class GetOrderRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private String fields; + private String expand; + + public GetOrderRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + public GetOrderRequest fields(String fields) { + this.fields = fields; + return this; + } + + public GetOrderRequest expand(String expand) { + this.expand = expand; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.ORDER_PATH + "/" + id; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + List localVarQueryParams = new ArrayList(); + if (fields != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.FIELDS, fields)); + if (expand != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.EXPAND, expand)); + + + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/order/LookUpOrderByFiltersRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/order/LookUpOrderByFiltersRequest.java new file mode 100644 index 0000000..af31ed5 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/order/LookUpOrderByFiltersRequest.java @@ -0,0 +1,90 @@ +package mobi.appcent.medusa.store.model.request.order; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.QueryParamConstant; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.ShippingAddress; +import mobi.appcent.medusa.store.model.response.StoreOrdersRes; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 9.03.2023 + */ +public class LookUpOrderByFiltersRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final BigDecimal displayId; + private final String email; + private String fields; + private String expand; + private ShippingAddress shippingAddress; + + public LookUpOrderByFiltersRequest(MedusaSdkClient client, BigDecimal displayId, String email) { + this.client = client; + this.displayId = displayId; + this.email = email; + } + + public LookUpOrderByFiltersRequest fields(String fields) { + this.fields = fields; + return this; + } + + public LookUpOrderByFiltersRequest expand(String expand) { + this.expand = expand; + return this; + } + + public LookUpOrderByFiltersRequest expand(ShippingAddress shippingAddress) { + this.shippingAddress = shippingAddress; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.ORDER_PATH; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + List localVarQueryParams = new ArrayList(); + if (displayId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.DISPLAY_ID, displayId)); + if (fields != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.FIELDS, fields)); + if (expand != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.EXPAND, expand)); + if (email != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.EMAIL, email)); + if (shippingAddress != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.SHIPPING_ADDRESS, shippingAddress)); + + + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/order/VerifyOrderClaimRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/order/VerifyOrderClaimRequest.java new file mode 100644 index 0000000..8fb5285 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/order/VerifyOrderClaimRequest.java @@ -0,0 +1,60 @@ +package mobi.appcent.medusa.store.model.request.order; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StorePostCustomersCustomerAcceptClaimReq; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 9.03.2023 + */ +public class VerifyOrderClaimRequest extends BaseRequest { + + private final MedusaSdkClient client; + private StorePostCustomersCustomerAcceptClaimReq body; + + public VerifyOrderClaimRequest(MedusaSdkClient client) { + this.client = client; + } + + public VerifyOrderClaimRequest body(StorePostCustomersCustomerAcceptClaimReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.ORDER_PATH + "/customer/confirm"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/test/java/mobi/appcent/medusa/store/api/OrderApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/OrderApiTest.java index b7e9649..189ad5d 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/OrderApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/OrderApiTest.java @@ -44,7 +44,7 @@ public void getOrdersTest() throws Exception { String fields = null; String expand = null; ShippingAddress shippingAddress = null; - StoreOrdersRes response = api.getOrders(displayId, email, fields, expand, shippingAddress); + StoreOrdersRes response = api.getOrder(displayId, email).execute().getData(); // TODO: test validations } @@ -61,7 +61,7 @@ public void getOrdersOrderTest() throws Exception { String id = null; String fields = null; String expand = null; - StoreOrdersRes response = api.getOrdersOrder(id, fields, expand); + StoreOrdersRes response = api.getOrder(id).execute().getData(); // TODO: test validations } @@ -76,7 +76,7 @@ public void getOrdersOrderTest() throws Exception { @Test public void getOrdersOrderCartIdTest() throws Exception { String cartId = null; - StoreOrdersRes response = api.getOrdersOrderCartId(cartId); + StoreOrdersRes response = api.getOrderByCartId(cartId).execute().getData(); // TODO: test validations } @@ -91,7 +91,7 @@ public void getOrdersOrderCartIdTest() throws Exception { @Test public void postOrdersCustomerOrderClaimsCustomerOrderClaimAcceptTest() throws Exception { StorePostCustomersCustomerAcceptClaimReq body = null; - api.postOrdersCustomerOrderClaimsCustomerOrderClaimAccept(body); + api.verifyOrderClaim().execute(); // TODO: test validations } From d05effed9dc1b2c5903b3f6834d7dc0ce90c78f0 Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Thu, 9 Mar 2023 22:28:36 +0300 Subject: [PATCH 08/32] Feature/order api (#8) * feat(order-api): Refactor orders api * fix(order-api): Optimize imports --- .../medusa/store/model/request/invite/ClaimOrderRequest.java | 1 - .../medusa/store/model/request/order/GetOrderRequest.java | 1 - 2 files changed, 2 deletions(-) diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/invite/ClaimOrderRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/invite/ClaimOrderRequest.java index a9c8477..45bbdb6 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/invite/ClaimOrderRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/invite/ClaimOrderRequest.java @@ -1,7 +1,6 @@ package mobi.appcent.medusa.store.model.request.invite; import com.squareup.okhttp.Call; -import jdk.javadoc.internal.doclets.formats.html.markup.Head; import mobi.appcent.medusa.store.*; import mobi.appcent.medusa.store.common.HeaderConstant; import mobi.appcent.medusa.store.common.HttpMethod; diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderRequest.java index 2c52f16..8886175 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderRequest.java @@ -1,7 +1,6 @@ package mobi.appcent.medusa.store.model.request.order; import com.squareup.okhttp.Call; -import jdk.javadoc.internal.doclets.formats.html.markup.Head; import mobi.appcent.medusa.store.*; import mobi.appcent.medusa.store.common.HeaderConstant; import mobi.appcent.medusa.store.common.HttpMethod; From 301d5166ca69022f4edc86679526c68a475ac467 Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Fri, 10 Mar 2023 23:09:11 +0300 Subject: [PATCH 09/32] feat(order-edit-api): Refactor order edits api (#9) --- .../medusa/store/api/OrderEditApi.java | 363 +----------------- .../orderedit/CompletesOrderEditRequest.java | 55 +++ .../orderedit/DeclineOrderEditRequest.java | 62 +++ .../orderedit/RetrieveOrderEditRequest.java | 55 +++ .../medusa/store/api/OrderEditApiTest.java | 6 +- 5 files changed, 185 insertions(+), 356 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/orderedit/CompletesOrderEditRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/orderedit/DeclineOrderEditRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/orderedit/RetrieveOrderEditRequest.java diff --git a/src/main/java/mobi/appcent/medusa/store/api/OrderEditApi.java b/src/main/java/mobi/appcent/medusa/store/api/OrderEditApi.java index c93e338..cb3a8b0 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/OrderEditApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/OrderEditApi.java @@ -20,6 +20,9 @@ import java.io.IOException; +import mobi.appcent.medusa.store.model.request.orderedit.CompletesOrderEditRequest; +import mobi.appcent.medusa.store.model.request.orderedit.DeclineOrderEditRequest; +import mobi.appcent.medusa.store.model.request.orderedit.RetrieveOrderEditRequest; import mobi.appcent.medusa.store.model.response.StoreOrderEditsRes; import mobi.appcent.medusa.store.model.response.StorePostOrderEditsOrderEditDecline; @@ -42,72 +45,6 @@ public MedusaSdkClient getApiClient() { public void setApiClient(MedusaSdkClient medusaSdkClient) { this.medusaSdkClient = medusaSdkClient; - } - - /** - * Build call for getOrderEditsOrderEdit - * @param id The ID of the OrderEdit. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getOrderEditsOrderEditCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/order-edits/{id}" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getOrderEditsOrderEditValidateBeforeCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling getOrderEditsOrderEdit(Async)"); - } - - com.squareup.okhttp.Call call = getOrderEditsOrderEditCall(id, progressListener, progressRequestListener); - return call; - - - - - } /** @@ -117,122 +54,8 @@ private com.squareup.okhttp.Call getOrderEditsOrderEditValidateBeforeCall(String * @return StoreOrderEditsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreOrderEditsRes getOrderEditsOrderEdit(String id) throws ApiException { - ApiResponse resp = getOrderEditsOrderEditWithHttpInfo(id); - return resp.getData(); - } - - /** - * Retrieve an OrderEdit - * Retrieves a OrderEdit. - * @param id The ID of the OrderEdit. (required) - * @return ApiResponse<StoreOrderEditsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getOrderEditsOrderEditWithHttpInfo(String id) throws ApiException { - com.squareup.okhttp.Call call = getOrderEditsOrderEditValidateBeforeCall(id, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Retrieve an OrderEdit (asynchronously) - * Retrieves a OrderEdit. - * @param id The ID of the OrderEdit. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getOrderEditsOrderEditAsync(String id, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getOrderEditsOrderEditValidateBeforeCall(id, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postOrderEditsOrderEditComplete - * @param id The ID of the Order Edit. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postOrderEditsOrderEditCompleteCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/order-edits/{id}/complete" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postOrderEditsOrderEditCompleteValidateBeforeCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling postOrderEditsOrderEditComplete(Async)"); - } - - com.squareup.okhttp.Call call = postOrderEditsOrderEditCompleteCall(id, progressListener, progressRequestListener); - return call; - - - - - + public RetrieveOrderEditRequest retrieveOrderEdit(String id) throws ApiException { + return new RetrieveOrderEditRequest(medusaSdkClient, id); } /** @@ -242,185 +65,19 @@ private com.squareup.okhttp.Call postOrderEditsOrderEditCompleteValidateBeforeCa * @return StoreOrderEditsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreOrderEditsRes postOrderEditsOrderEditComplete(String id) throws ApiException { - ApiResponse resp = postOrderEditsOrderEditCompleteWithHttpInfo(id); - return resp.getData(); - } - - /** - * Completes an OrderEdit - * Completes an OrderEdit. - * @param id The ID of the Order Edit. (required) - * @return ApiResponse<StoreOrderEditsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postOrderEditsOrderEditCompleteWithHttpInfo(String id) throws ApiException { - com.squareup.okhttp.Call call = postOrderEditsOrderEditCompleteValidateBeforeCall(id, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Completes an OrderEdit (asynchronously) - * Completes an OrderEdit. - * @param id The ID of the Order Edit. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postOrderEditsOrderEditCompleteAsync(String id, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postOrderEditsOrderEditCompleteValidateBeforeCall(id, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postOrderEditsOrderEditDecline - * @param id The ID of the OrderEdit. (required) - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postOrderEditsOrderEditDeclineCall(String id, StorePostOrderEditsOrderEditDecline body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/order-edits/{id}/decline" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postOrderEditsOrderEditDeclineValidateBeforeCall(String id, StorePostOrderEditsOrderEditDecline body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling postOrderEditsOrderEditDecline(Async)"); - } - - com.squareup.okhttp.Call call = postOrderEditsOrderEditDeclineCall(id, body, progressListener, progressRequestListener); - return call; - - - - - + public CompletesOrderEditRequest completesOrderEdit(String id) throws ApiException { + return new CompletesOrderEditRequest(medusaSdkClient, id); } /** * Decline an OrderEdit * Declines an OrderEdit. * @param id The ID of the OrderEdit. (required) - * @param body (optional) + * body (optional) * @return StoreOrderEditsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreOrderEditsRes postOrderEditsOrderEditDecline(String id, StorePostOrderEditsOrderEditDecline body) throws ApiException { - ApiResponse resp = postOrderEditsOrderEditDeclineWithHttpInfo(id, body); - return resp.getData(); - } - - /** - * Decline an OrderEdit - * Declines an OrderEdit. - * @param id The ID of the OrderEdit. (required) - * @param body (optional) - * @return ApiResponse<StoreOrderEditsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postOrderEditsOrderEditDeclineWithHttpInfo(String id, StorePostOrderEditsOrderEditDecline body) throws ApiException { - com.squareup.okhttp.Call call = postOrderEditsOrderEditDeclineValidateBeforeCall(id, body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Decline an OrderEdit (asynchronously) - * Declines an OrderEdit. - * @param id The ID of the OrderEdit. (required) - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postOrderEditsOrderEditDeclineAsync(String id, StorePostOrderEditsOrderEditDecline body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postOrderEditsOrderEditDeclineValidateBeforeCall(id, body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; + public DeclineOrderEditRequest declineOrderEdit(String id) throws ApiException { + return new DeclineOrderEditRequest(medusaSdkClient, id); } } diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/CompletesOrderEditRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/CompletesOrderEditRequest.java new file mode 100644 index 0000000..d831c50 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/CompletesOrderEditRequest.java @@ -0,0 +1,55 @@ +package mobi.appcent.medusa.store.model.request.orderedit; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreOrderEditsRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 10.03.2023 + */ +public class CompletesOrderEditRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + + public CompletesOrderEditRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.ORDER_EDIT_PATH + "/" + id + "/complete"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/DeclineOrderEditRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/DeclineOrderEditRequest.java new file mode 100644 index 0000000..1415240 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/DeclineOrderEditRequest.java @@ -0,0 +1,62 @@ +package mobi.appcent.medusa.store.model.request.orderedit; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreOrderEditsRes; +import mobi.appcent.medusa.store.model.response.StorePostOrderEditsOrderEditDecline; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 10.03.2023 + */ +public class DeclineOrderEditRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private StorePostOrderEditsOrderEditDecline body; + + public DeclineOrderEditRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + public DeclineOrderEditRequest body(StorePostOrderEditsOrderEditDecline body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.ORDER_EDIT_PATH + "/" + id + "/decline"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/RetrieveOrderEditRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/RetrieveOrderEditRequest.java new file mode 100644 index 0000000..aa40cdb --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/RetrieveOrderEditRequest.java @@ -0,0 +1,55 @@ +package mobi.appcent.medusa.store.model.request.orderedit; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreOrderEditsRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 10.03.2023 + */ +public class RetrieveOrderEditRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + + public RetrieveOrderEditRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.ORDER_EDIT_PATH + "/" + id; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/test/java/mobi/appcent/medusa/store/api/OrderEditApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/OrderEditApiTest.java index 60561ed..9d8e5d1 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/OrderEditApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/OrderEditApiTest.java @@ -37,7 +37,7 @@ public class OrderEditApiTest { @Test public void getOrderEditsOrderEditTest() throws Exception { String id = null; - StoreOrderEditsRes response = api.getOrderEditsOrderEdit(id); + StoreOrderEditsRes response = api.retrieveOrderEdit(id).execute().getData(); // TODO: test validations } @@ -52,7 +52,7 @@ public void getOrderEditsOrderEditTest() throws Exception { @Test public void postOrderEditsOrderEditCompleteTest() throws Exception { String id = null; - StoreOrderEditsRes response = api.postOrderEditsOrderEditComplete(id); + StoreOrderEditsRes response = api.completesOrderEdit(id).execute().getData(); // TODO: test validations } @@ -68,7 +68,7 @@ public void postOrderEditsOrderEditCompleteTest() throws Exception { public void postOrderEditsOrderEditDeclineTest() throws Exception { String id = null; StorePostOrderEditsOrderEditDecline body = null; - StoreOrderEditsRes response = api.postOrderEditsOrderEditDecline(id, body); + StoreOrderEditsRes response = api.declineOrderEdit(id).execute().getData(); // TODO: test validations } From 8b22b6f562db6aef4661b46e26fee4bb8002b14d Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Fri, 10 Mar 2023 23:09:41 +0300 Subject: [PATCH 10/32] feat(payment-collection-api): Refactor payment collection api (#10) --- .../store/api/PaymentCollectionApi.java | 755 +----------------- .../AuthorizePaymentSessionRequest.java | 58 ++ .../AuthorizePaymentSessionsRequest.java | 63 ++ .../GetPaymentCollectionRequest.java | 73 ++ .../ManagePaymentSessionRequest.java | 63 ++ .../ManagePaymentSessionsRequest.java | 63 ++ .../RefreshPaymentSessionRequest.java | 57 ++ .../store/api/PaymentCollectionApiTest.java | 12 +- 8 files changed, 401 insertions(+), 743 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/AuthorizePaymentSessionRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/AuthorizePaymentSessionsRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/GetPaymentCollectionRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/ManagePaymentSessionRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/ManagePaymentSessionsRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/RefreshPaymentSessionRequest.java diff --git a/src/main/java/mobi/appcent/medusa/store/api/PaymentCollectionApi.java b/src/main/java/mobi/appcent/medusa/store/api/PaymentCollectionApi.java index a8ed548..a1046e0 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/PaymentCollectionApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/PaymentCollectionApi.java @@ -20,6 +20,7 @@ import java.io.IOException; +import mobi.appcent.medusa.store.model.request.paymentcollection.*; import mobi.appcent.medusa.store.model.response.StorePaymentCollectionSessionsReq; import mobi.appcent.medusa.store.model.response.StorePaymentCollectionsRes; import mobi.appcent.medusa.store.model.response.StorePaymentCollectionsSessionRes; @@ -45,215 +46,19 @@ public MedusaSdkClient getApiClient() { public void setApiClient(MedusaSdkClient medusaSdkClient) { this.medusaSdkClient = medusaSdkClient; - } - - /** - * Build call for getPaymentCollectionsPaymentCollection - * @param id The ID of the PaymentCollection. (required) - * @param expand Comma separated list of relations to include in the results. (optional) - * @param fields Comma separated list of fields to include in the results. (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getPaymentCollectionsPaymentCollectionCall(String id, String expand, String fields, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/payment-collections/{id}" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - if (expand != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("expand", expand)); - if (fields != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("fields", fields)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getPaymentCollectionsPaymentCollectionValidateBeforeCall(String id, String expand, String fields, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling getPaymentCollectionsPaymentCollection(Async)"); - } - - com.squareup.okhttp.Call call = getPaymentCollectionsPaymentCollectionCall(id, expand, fields, progressListener, progressRequestListener); - return call; - - - - - } /** * Get a PaymentCollection * Get a Payment Collection * @param id The ID of the PaymentCollection. (required) - * @param expand Comma separated list of relations to include in the results. (optional) - * @param fields Comma separated list of fields to include in the results. (optional) + * expand Comma separated list of relations to include in the results. (optional) + * fields Comma separated list of fields to include in the results. (optional) * @return StorePaymentCollectionsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StorePaymentCollectionsRes getPaymentCollectionsPaymentCollection(String id, String expand, String fields) throws ApiException { - ApiResponse resp = getPaymentCollectionsPaymentCollectionWithHttpInfo(id, expand, fields); - return resp.getData(); - } - - /** - * Get a PaymentCollection - * Get a Payment Collection - * @param id The ID of the PaymentCollection. (required) - * @param expand Comma separated list of relations to include in the results. (optional) - * @param fields Comma separated list of fields to include in the results. (optional) - * @return ApiResponse<StorePaymentCollectionsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getPaymentCollectionsPaymentCollectionWithHttpInfo(String id, String expand, String fields) throws ApiException { - com.squareup.okhttp.Call call = getPaymentCollectionsPaymentCollectionValidateBeforeCall(id, expand, fields, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Get a PaymentCollection (asynchronously) - * Get a Payment Collection - * @param id The ID of the PaymentCollection. (required) - * @param expand Comma separated list of relations to include in the results. (optional) - * @param fields Comma separated list of fields to include in the results. (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getPaymentCollectionsPaymentCollectionAsync(String id, String expand, String fields, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getPaymentCollectionsPaymentCollectionValidateBeforeCall(id, expand, fields, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postPaymentCollectionsPaymentCollectionPaymentSessionsSession - * @param id The id of the PaymentCollection. (required) - * @param sessionId The id of the Payment Session to be refreshed. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postPaymentCollectionsPaymentCollectionPaymentSessionsSessionCall(String id, String sessionId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/payment-collections/{id}/sessions/{session_id}" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())) - .replaceAll("\\{" + "session_id" + "\\}", medusaSdkClient.escapeString(sessionId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postPaymentCollectionsPaymentCollectionPaymentSessionsSessionValidateBeforeCall(String id, String sessionId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling postPaymentCollectionsPaymentCollectionPaymentSessionsSession(Async)"); - } - // verify the required parameter 'sessionId' is set - if (sessionId == null) { - throw new ApiException("Missing the required parameter 'sessionId' when calling postPaymentCollectionsPaymentCollectionPaymentSessionsSession(Async)"); - } - - com.squareup.okhttp.Call call = postPaymentCollectionsPaymentCollectionPaymentSessionsSessionCall(id, sessionId, progressListener, progressRequestListener); - return call; - - - - - + public GetPaymentCollectionRequest getPaymentCollection(String id) throws ApiException { + return new GetPaymentCollectionRequest(medusaSdkClient, id); } /** @@ -264,517 +69,44 @@ private com.squareup.okhttp.Call postPaymentCollectionsPaymentCollectionPaymentS * @return StorePaymentCollectionsSessionRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StorePaymentCollectionsSessionRes postPaymentCollectionsPaymentCollectionPaymentSessionsSession(String id, String sessionId) throws ApiException { - ApiResponse resp = postPaymentCollectionsPaymentCollectionPaymentSessionsSessionWithHttpInfo(id, sessionId); - return resp.getData(); - } - - /** - * Refresh a Payment Session - * Refreshes a Payment Session to ensure that it is in sync with the Payment Collection. - * @param id The id of the PaymentCollection. (required) - * @param sessionId The id of the Payment Session to be refreshed. (required) - * @return ApiResponse<StorePaymentCollectionsSessionRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postPaymentCollectionsPaymentCollectionPaymentSessionsSessionWithHttpInfo(String id, String sessionId) throws ApiException { - com.squareup.okhttp.Call call = postPaymentCollectionsPaymentCollectionPaymentSessionsSessionValidateBeforeCall(id, sessionId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Refresh a Payment Session (asynchronously) - * Refreshes a Payment Session to ensure that it is in sync with the Payment Collection. - * @param id The id of the PaymentCollection. (required) - * @param sessionId The id of the Payment Session to be refreshed. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postPaymentCollectionsPaymentCollectionPaymentSessionsSessionAsync(String id, String sessionId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postPaymentCollectionsPaymentCollectionPaymentSessionsSessionValidateBeforeCall(id, sessionId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postPaymentCollectionsPaymentCollectionSessionsBatch - * @param id The ID of the Payment Collections. (required) - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postPaymentCollectionsPaymentCollectionSessionsBatchCall(String id, StorePostPaymentCollectionsBatchSessionsReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/payment-collections/{id}/sessions/batch" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postPaymentCollectionsPaymentCollectionSessionsBatchValidateBeforeCall(String id, StorePostPaymentCollectionsBatchSessionsReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling postPaymentCollectionsPaymentCollectionSessionsBatch(Async)"); - } - - com.squareup.okhttp.Call call = postPaymentCollectionsPaymentCollectionSessionsBatchCall(id, body, progressListener, progressRequestListener); - return call; - - - - - + public RefreshPaymentSessionRequest refreshPaymentSession(String id, String sessionId) throws ApiException { + return new RefreshPaymentSessionRequest(medusaSdkClient, id, sessionId); } /** * Manage Payment Sessions * Manages Multiple Payment Sessions from Payment Collections. * @param id The ID of the Payment Collections. (required) - * @param body (optional) + * body (optional) * @return StorePaymentCollectionsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StorePaymentCollectionsRes postPaymentCollectionsPaymentCollectionSessionsBatch(String id, StorePostPaymentCollectionsBatchSessionsReq body) throws ApiException { - ApiResponse resp = postPaymentCollectionsPaymentCollectionSessionsBatchWithHttpInfo(id, body); - return resp.getData(); - } - - /** - * Manage Payment Sessions - * Manages Multiple Payment Sessions from Payment Collections. - * @param id The ID of the Payment Collections. (required) - * @param body (optional) - * @return ApiResponse<StorePaymentCollectionsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postPaymentCollectionsPaymentCollectionSessionsBatchWithHttpInfo(String id, StorePostPaymentCollectionsBatchSessionsReq body) throws ApiException { - com.squareup.okhttp.Call call = postPaymentCollectionsPaymentCollectionSessionsBatchValidateBeforeCall(id, body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Manage Payment Sessions (asynchronously) - * Manages Multiple Payment Sessions from Payment Collections. - * @param id The ID of the Payment Collections. (required) - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postPaymentCollectionsPaymentCollectionSessionsBatchAsync(String id, StorePostPaymentCollectionsBatchSessionsReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postPaymentCollectionsPaymentCollectionSessionsBatchValidateBeforeCall(id, body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postPaymentCollectionsSessions - * @param id The ID of the Payment Collection. (required) - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postPaymentCollectionsSessionsCall(String id, StorePaymentCollectionSessionsReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/payment-collections/{id}/sessions" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postPaymentCollectionsSessionsValidateBeforeCall(String id, StorePaymentCollectionSessionsReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling postPaymentCollectionsSessions(Async)"); - } - - com.squareup.okhttp.Call call = postPaymentCollectionsSessionsCall(id, body, progressListener, progressRequestListener); - return call; - - - - - + public ManagePaymentSessionsRequest managePaymentSessions(String id) throws ApiException { + return new ManagePaymentSessionsRequest(medusaSdkClient, id); } /** * Manage a Payment Session * Manages Payment Sessions from Payment Collections. * @param id The ID of the Payment Collection. (required) - * @param body (optional) + * body (optional) * @return StorePaymentCollectionsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StorePaymentCollectionsRes postPaymentCollectionsSessions(String id, StorePaymentCollectionSessionsReq body) throws ApiException { - ApiResponse resp = postPaymentCollectionsSessionsWithHttpInfo(id, body); - return resp.getData(); - } - - /** - * Manage a Payment Session - * Manages Payment Sessions from Payment Collections. - * @param id The ID of the Payment Collection. (required) - * @param body (optional) - * @return ApiResponse<StorePaymentCollectionsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postPaymentCollectionsSessionsWithHttpInfo(String id, StorePaymentCollectionSessionsReq body) throws ApiException { - com.squareup.okhttp.Call call = postPaymentCollectionsSessionsValidateBeforeCall(id, body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Manage a Payment Session (asynchronously) - * Manages Payment Sessions from Payment Collections. - * @param id The ID of the Payment Collection. (required) - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postPaymentCollectionsSessionsAsync(String id, StorePaymentCollectionSessionsReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postPaymentCollectionsSessionsValidateBeforeCall(id, body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postPaymentCollectionsSessionsBatchAuthorize - * @param id The ID of the Payment Collections. (required) - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postPaymentCollectionsSessionsBatchAuthorizeCall(String id, StorePostPaymentCollectionsBatchSessionsAuthorizeReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/payment-collections/{id}/sessions/batch/authorize" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postPaymentCollectionsSessionsBatchAuthorizeValidateBeforeCall(String id, StorePostPaymentCollectionsBatchSessionsAuthorizeReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling postPaymentCollectionsSessionsBatchAuthorize(Async)"); - } - - com.squareup.okhttp.Call call = postPaymentCollectionsSessionsBatchAuthorizeCall(id, body, progressListener, progressRequestListener); - return call; - - - - - + public ManagePaymentSessionRequest managePaymentSession(String id) throws ApiException { + return new ManagePaymentSessionRequest(medusaSdkClient, id); } /** * Authorize PaymentSessions * Authorizes Payment Sessions of a Payment Collection. * @param id The ID of the Payment Collections. (required) - * @param body (optional) + * body (optional) * @return StorePaymentCollectionsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StorePaymentCollectionsRes postPaymentCollectionsSessionsBatchAuthorize(String id, StorePostPaymentCollectionsBatchSessionsAuthorizeReq body) throws ApiException { - ApiResponse resp = postPaymentCollectionsSessionsBatchAuthorizeWithHttpInfo(id, body); - return resp.getData(); - } - - /** - * Authorize PaymentSessions - * Authorizes Payment Sessions of a Payment Collection. - * @param id The ID of the Payment Collections. (required) - * @param body (optional) - * @return ApiResponse<StorePaymentCollectionsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postPaymentCollectionsSessionsBatchAuthorizeWithHttpInfo(String id, StorePostPaymentCollectionsBatchSessionsAuthorizeReq body) throws ApiException { - com.squareup.okhttp.Call call = postPaymentCollectionsSessionsBatchAuthorizeValidateBeforeCall(id, body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Authorize PaymentSessions (asynchronously) - * Authorizes Payment Sessions of a Payment Collection. - * @param id The ID of the Payment Collections. (required) - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postPaymentCollectionsSessionsBatchAuthorizeAsync(String id, StorePostPaymentCollectionsBatchSessionsAuthorizeReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postPaymentCollectionsSessionsBatchAuthorizeValidateBeforeCall(id, body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postPaymentCollectionsSessionsSessionAuthorize - * @param id The ID of the Payment Collections. (required) - * @param sessionId The ID of the Payment Session. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postPaymentCollectionsSessionsSessionAuthorizeCall(String id, String sessionId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/payment-collections/{id}/sessions/{session_id}/authorize" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())) - .replaceAll("\\{" + "session_id" + "\\}", medusaSdkClient.escapeString(sessionId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postPaymentCollectionsSessionsSessionAuthorizeValidateBeforeCall(String id, String sessionId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling postPaymentCollectionsSessionsSessionAuthorize(Async)"); - } - // verify the required parameter 'sessionId' is set - if (sessionId == null) { - throw new ApiException("Missing the required parameter 'sessionId' when calling postPaymentCollectionsSessionsSessionAuthorize(Async)"); - } - - com.squareup.okhttp.Call call = postPaymentCollectionsSessionsSessionAuthorizeCall(id, sessionId, progressListener, progressRequestListener); - return call; - - - - - + public AuthorizePaymentSessionsRequest authorizePaymentSessions(String id) throws ApiException { + return new AuthorizePaymentSessionsRequest(medusaSdkClient, id); } /** @@ -785,58 +117,7 @@ private com.squareup.okhttp.Call postPaymentCollectionsSessionsSessionAuthorizeV * @return StorePaymentCollectionsSessionRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StorePaymentCollectionsSessionRes postPaymentCollectionsSessionsSessionAuthorize(String id, String sessionId) throws ApiException { - ApiResponse resp = postPaymentCollectionsSessionsSessionAuthorizeWithHttpInfo(id, sessionId); - return resp.getData(); - } - - /** - * Authorize Payment Session - * Authorizes a Payment Session of a Payment Collection. - * @param id The ID of the Payment Collections. (required) - * @param sessionId The ID of the Payment Session. (required) - * @return ApiResponse<StorePaymentCollectionsSessionRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postPaymentCollectionsSessionsSessionAuthorizeWithHttpInfo(String id, String sessionId) throws ApiException { - com.squareup.okhttp.Call call = postPaymentCollectionsSessionsSessionAuthorizeValidateBeforeCall(id, sessionId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Authorize Payment Session (asynchronously) - * Authorizes a Payment Session of a Payment Collection. - * @param id The ID of the Payment Collections. (required) - * @param sessionId The ID of the Payment Session. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postPaymentCollectionsSessionsSessionAuthorizeAsync(String id, String sessionId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postPaymentCollectionsSessionsSessionAuthorizeValidateBeforeCall(id, sessionId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; + public AuthorizePaymentSessionRequest authorizePaymentSession(String id, String sessionId) throws ApiException { + return new AuthorizePaymentSessionRequest(medusaSdkClient, id, sessionId); } } diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/AuthorizePaymentSessionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/AuthorizePaymentSessionRequest.java new file mode 100644 index 0000000..cdb3b55 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/AuthorizePaymentSessionRequest.java @@ -0,0 +1,58 @@ +package mobi.appcent.medusa.store.model.request.paymentcollection; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StorePaymentCollectionsSessionRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 10.03.2023 + */ +public class AuthorizePaymentSessionRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private final String sessionId; + + public AuthorizePaymentSessionRequest(MedusaSdkClient client, String id, String sessionId) { + this.client = client; + this.id = id; + this.sessionId = sessionId; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.PAYMENT_COLLECTION_PATH + "/" + id + "/sessions/" + sessionId + "/authorize"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/AuthorizePaymentSessionsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/AuthorizePaymentSessionsRequest.java new file mode 100644 index 0000000..6ac9476 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/AuthorizePaymentSessionsRequest.java @@ -0,0 +1,63 @@ +package mobi.appcent.medusa.store.model.request.paymentcollection; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StorePaymentCollectionsRes; +import mobi.appcent.medusa.store.model.response.StorePostPaymentCollectionsBatchSessionsAuthorizeReq; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 10.03.2023 + */ +public class AuthorizePaymentSessionsRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private StorePostPaymentCollectionsBatchSessionsAuthorizeReq body; + + public AuthorizePaymentSessionsRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + public AuthorizePaymentSessionsRequest body(StorePostPaymentCollectionsBatchSessionsAuthorizeReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.PAYMENT_COLLECTION_PATH + "/" + id + "/sessions/batch/authorize"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/GetPaymentCollectionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/GetPaymentCollectionRequest.java new file mode 100644 index 0000000..7d5a8a1 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/GetPaymentCollectionRequest.java @@ -0,0 +1,73 @@ +package mobi.appcent.medusa.store.model.request.paymentcollection; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StorePaymentCollectionsRes; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 10.03.2023 + */ +public class GetPaymentCollectionRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private String expand; + private String fields; + + public GetPaymentCollectionRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + public GetPaymentCollectionRequest expand(String expand) { + this.expand = expand; + return this; + } + + public GetPaymentCollectionRequest fields(String fields) { + this.fields = fields; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.PAYMENT_COLLECTION_PATH + "/" + id; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + + List localVarQueryParams = new ArrayList(); + if (expand != null) + localVarQueryParams.addAll(client.parameterToPair("expand", expand)); + if (fields != null) + localVarQueryParams.addAll(client.parameterToPair("fields", fields)); + + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/ManagePaymentSessionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/ManagePaymentSessionRequest.java new file mode 100644 index 0000000..112003c --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/ManagePaymentSessionRequest.java @@ -0,0 +1,63 @@ +package mobi.appcent.medusa.store.model.request.paymentcollection; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StorePaymentCollectionSessionsReq; +import mobi.appcent.medusa.store.model.response.StorePaymentCollectionsRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 10.03.2023 + */ +public class ManagePaymentSessionRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private StorePaymentCollectionSessionsReq body; + + public ManagePaymentSessionRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + public ManagePaymentSessionRequest body(StorePaymentCollectionSessionsReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.PAYMENT_COLLECTION_PATH + "/" + id + "/sessions"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/ManagePaymentSessionsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/ManagePaymentSessionsRequest.java new file mode 100644 index 0000000..99ca119 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/ManagePaymentSessionsRequest.java @@ -0,0 +1,63 @@ +package mobi.appcent.medusa.store.model.request.paymentcollection; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StorePaymentCollectionsRes; +import mobi.appcent.medusa.store.model.response.StorePostPaymentCollectionsBatchSessionsReq; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 10.03.2023 + */ +public class ManagePaymentSessionsRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private StorePostPaymentCollectionsBatchSessionsReq body; + + public ManagePaymentSessionsRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + public ManagePaymentSessionsRequest body(StorePostPaymentCollectionsBatchSessionsReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.PAYMENT_COLLECTION_PATH + "/" + id + "/sessions/batch"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/RefreshPaymentSessionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/RefreshPaymentSessionRequest.java new file mode 100644 index 0000000..5d644d0 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/RefreshPaymentSessionRequest.java @@ -0,0 +1,57 @@ +package mobi.appcent.medusa.store.model.request.paymentcollection; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StorePaymentCollectionsSessionRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 10.03.2023 + */ +public class RefreshPaymentSessionRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private final String sessionId; + + public RefreshPaymentSessionRequest(MedusaSdkClient client, String id, String sessionId) { + this.client = client; + this.id = id; + this.sessionId = sessionId; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.PAYMENT_COLLECTION_PATH + "/" + id + "/sessions/" + sessionId; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/test/java/mobi/appcent/medusa/store/api/PaymentCollectionApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/PaymentCollectionApiTest.java index 5204e01..c084053 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/PaymentCollectionApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/PaymentCollectionApiTest.java @@ -42,7 +42,7 @@ public void getPaymentCollectionsPaymentCollectionTest() throws Exception { String id = null; String expand = null; String fields = null; - StorePaymentCollectionsRes response = api.getPaymentCollectionsPaymentCollection(id, expand, fields); + StorePaymentCollectionsRes response = api.getPaymentCollection(id).execute().getData(); // TODO: test validations } @@ -58,7 +58,7 @@ public void getPaymentCollectionsPaymentCollectionTest() throws Exception { public void postPaymentCollectionsPaymentCollectionPaymentSessionsSessionTest() throws Exception { String id = null; String sessionId = null; - StorePaymentCollectionsSessionRes response = api.postPaymentCollectionsPaymentCollectionPaymentSessionsSession(id, sessionId); + StorePaymentCollectionsSessionRes response = api.refreshPaymentSession(id, sessionId).execute().getData(); // TODO: test validations } @@ -74,7 +74,7 @@ public void postPaymentCollectionsPaymentCollectionPaymentSessionsSessionTest() public void postPaymentCollectionsPaymentCollectionSessionsBatchTest() throws Exception { String id = null; StorePostPaymentCollectionsBatchSessionsReq body = null; - StorePaymentCollectionsRes response = api.postPaymentCollectionsPaymentCollectionSessionsBatch(id, body); + StorePaymentCollectionsRes response = api.managePaymentSessions(id).execute().getData(); // TODO: test validations } @@ -90,7 +90,7 @@ public void postPaymentCollectionsPaymentCollectionSessionsBatchTest() throws Ex public void postPaymentCollectionsSessionsTest() throws Exception { String id = null; StorePaymentCollectionSessionsReq body = null; - StorePaymentCollectionsRes response = api.postPaymentCollectionsSessions(id, body); + StorePaymentCollectionsRes response = api.managePaymentSession(id).execute().getData(); // TODO: test validations } @@ -106,7 +106,7 @@ public void postPaymentCollectionsSessionsTest() throws Exception { public void postPaymentCollectionsSessionsBatchAuthorizeTest() throws Exception { String id = null; StorePostPaymentCollectionsBatchSessionsAuthorizeReq body = null; - StorePaymentCollectionsRes response = api.postPaymentCollectionsSessionsBatchAuthorize(id, body); + StorePaymentCollectionsRes response = api.authorizePaymentSessions(id).execute().getData(); // TODO: test validations } @@ -122,7 +122,7 @@ public void postPaymentCollectionsSessionsBatchAuthorizeTest() throws Exception public void postPaymentCollectionsSessionsSessionAuthorizeTest() throws Exception { String id = null; String sessionId = null; - StorePaymentCollectionsSessionRes response = api.postPaymentCollectionsSessionsSessionAuthorize(id, sessionId); + StorePaymentCollectionsSessionRes response = api.authorizePaymentSession(id, sessionId).execute().getData(); // TODO: test validations } From 448517ee3bc88749873b46319584eff88a691a6b Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Fri, 10 Mar 2023 23:10:08 +0300 Subject: [PATCH 11/32] feat(product-api): Refactor product api (#11) --- .../appcent/medusa/store/api/ProductApi.java | 561 ++---------------- .../store/common/QueryParamConstant.java | 12 + .../request/product/GetProductRequest.java | 107 ++++ .../request/product/ListProductsRequest.java | 234 ++++++++ .../product/SearchProductsRequest.java | 76 +++ .../medusa/store/api/ProductApiTest.java | 6 +- 6 files changed, 471 insertions(+), 525 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/product/GetProductRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/product/ListProductsRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/product/SearchProductsRequest.java diff --git a/src/main/java/mobi/appcent/medusa/store/api/ProductApi.java b/src/main/java/mobi/appcent/medusa/store/api/ProductApi.java index 5b1d7d8..d9e3c78 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ProductApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ProductApi.java @@ -20,6 +20,9 @@ import java.io.IOException; +import mobi.appcent.medusa.store.model.request.product.GetProductRequest; +import mobi.appcent.medusa.store.model.request.product.ListProductsRequest; +import mobi.appcent.medusa.store.model.request.product.SearchProductsRequest; import mobi.appcent.medusa.store.model.response.CreatedAt4; import mobi.appcent.medusa.store.model.response.Id; import mobi.appcent.medusa.store.model.response.StorePostSearchRes; @@ -46,553 +49,67 @@ public MedusaSdkClient getApiClient() { public void setApiClient(MedusaSdkClient medusaSdkClient) { this.medusaSdkClient = medusaSdkClient; - } - - /** - * Build call for getProducts - * @param q Query used for searching products by title, description, variant's title, variant's sku, and collection's title (optional) - * @param id product IDs to search for. (optional) - * @param salesChannelId an array of sales channel IDs to filter the retrieved products by. (optional) - * @param collectionId Collection IDs to search for (optional) - * @param typeId Type IDs to search for (optional) - * @param tags Tag IDs to search for (optional) - * @param title title to search for. (optional) - * @param description description to search for. (optional) - * @param handle handle to search for. (optional) - * @param isGiftcard Search for giftcards using is_giftcard=true. (optional) - * @param createdAt Date comparison for when resulting products were created. (optional) - * @param updatedAt Date comparison for when resulting products were updated. (optional) - * @param categoryId Category ids to filter by. (optional) - * @param includeCategoryChildren Include category children when filtering by category_id. (optional) - * @param offset How many products to skip in the result. (optional, default to 0) - * @param limit Limit the number of products returned. (optional, default to 100) - * @param expand (Comma separated) Which fields should be expanded in each product of the result. (optional) - * @param fields (Comma separated) Which fields should be included in each product of the result. (optional) - * @param order the field used to order the products. (optional) - * @param cartId The id of the Cart to set prices based on. (optional) - * @param regionId The id of the Region to set prices based on. (optional) - * @param currencyCode The currency code to use for price selection. (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getProductsCall(String q, Id id, List salesChannelId, List collectionId, List typeId, List tags, String title, String description, String handle, Boolean isGiftcard, CreatedAt4 createdAt, UpdatedAt4 updatedAt, List categoryId, Boolean includeCategoryChildren, Integer offset, Integer limit, String expand, String fields, String order, String cartId, String regionId, String currencyCode, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/products"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - if (q != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("q", q)); - if (id != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("id", id)); - if (salesChannelId != null) - localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "sales_channel_id", salesChannelId)); - if (collectionId != null) - localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "collection_id", collectionId)); - if (typeId != null) - localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "type_id", typeId)); - if (tags != null) - localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "tags", tags)); - if (title != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("title", title)); - if (description != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("description", description)); - if (handle != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("handle", handle)); - if (isGiftcard != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("is_giftcard", isGiftcard)); - if (createdAt != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("created_at", createdAt)); - if (updatedAt != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("updated_at", updatedAt)); - if (categoryId != null) - localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "category_id", categoryId)); - if (includeCategoryChildren != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("include_category_children", includeCategoryChildren)); - if (offset != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("offset", offset)); - if (limit != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("limit", limit)); - if (expand != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("expand", expand)); - if (fields != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("fields", fields)); - if (order != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("order", order)); - if (cartId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("cart_id", cartId)); - if (regionId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("region_id", regionId)); - if (currencyCode != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("currency_code", currencyCode)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getProductsValidateBeforeCall(String q, Id id, List salesChannelId, List collectionId, List typeId, List tags, String title, String description, String handle, Boolean isGiftcard, CreatedAt4 createdAt, UpdatedAt4 updatedAt, List categoryId, Boolean includeCategoryChildren, Integer offset, Integer limit, String expand, String fields, String order, String cartId, String regionId, String currencyCode, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = getProductsCall(q, id, salesChannelId, collectionId, typeId, tags, title, description, handle, isGiftcard, createdAt, updatedAt, categoryId, includeCategoryChildren, offset, limit, expand, fields, order, cartId, regionId, currencyCode, progressListener, progressRequestListener); - return call; - - - - - } /** * List Products * Retrieves a list of Products. - * @param q Query used for searching products by title, description, variant's title, variant's sku, and collection's title (optional) - * @param id product IDs to search for. (optional) - * @param salesChannelId an array of sales channel IDs to filter the retrieved products by. (optional) - * @param collectionId Collection IDs to search for (optional) - * @param typeId Type IDs to search for (optional) - * @param tags Tag IDs to search for (optional) - * @param title title to search for. (optional) - * @param description description to search for. (optional) - * @param handle handle to search for. (optional) - * @param isGiftcard Search for giftcards using is_giftcard=true. (optional) - * @param createdAt Date comparison for when resulting products were created. (optional) - * @param updatedAt Date comparison for when resulting products were updated. (optional) - * @param categoryId Category ids to filter by. (optional) - * @param includeCategoryChildren Include category children when filtering by category_id. (optional) - * @param offset How many products to skip in the result. (optional, default to 0) - * @param limit Limit the number of products returned. (optional, default to 100) - * @param expand (Comma separated) Which fields should be expanded in each product of the result. (optional) - * @param fields (Comma separated) Which fields should be included in each product of the result. (optional) - * @param order the field used to order the products. (optional) - * @param cartId The id of the Cart to set prices based on. (optional) - * @param regionId The id of the Region to set prices based on. (optional) - * @param currencyCode The currency code to use for price selection. (optional) + * q Query used for searching products by title, description, variant's title, variant's sku, and collection's title (optional) + * id product IDs to search for. (optional) + * salesChannelId an array of sales channel IDs to filter the retrieved products by. (optional) + * collectionId Collection IDs to search for (optional) + * typeId Type IDs to search for (optional) + * tags Tag IDs to search for (optional) + * title title to search for. (optional) + * description description to search for. (optional) + * handle handle to search for. (optional) + * isGiftcard Search for giftcards using is_giftcard=true. (optional) + * createdAt Date comparison for when resulting products were created. (optional) + * updatedAt Date comparison for when resulting products were updated. (optional) + * categoryId Category ids to filter by. (optional) + * includeCategoryChildren Include category children when filtering by category_id. (optional) + * offset How many products to skip in the result. (optional, default to 0) + * limit Limit the number of products returned. (optional, default to 100) + * expand (Comma separated) Which fields should be expanded in each product of the result. (optional) + * fields (Comma separated) Which fields should be included in each product of the result. (optional) + * order the field used to order the products. (optional) + * cartId The id of the Cart to set prices based on. (optional) + * regionId The id of the Region to set prices based on. (optional) + * currencyCode The currency code to use for price selection. (optional) * @return StoreProductsListRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreProductsListRes getProducts(String q, Id id, List salesChannelId, List collectionId, List typeId, List tags, String title, String description, String handle, Boolean isGiftcard, CreatedAt4 createdAt, UpdatedAt4 updatedAt, List categoryId, Boolean includeCategoryChildren, Integer offset, Integer limit, String expand, String fields, String order, String cartId, String regionId, String currencyCode) throws ApiException { - ApiResponse resp = getProductsWithHttpInfo(q, id, salesChannelId, collectionId, typeId, tags, title, description, handle, isGiftcard, createdAt, updatedAt, categoryId, includeCategoryChildren, offset, limit, expand, fields, order, cartId, regionId, currencyCode); - return resp.getData(); - } - - /** - * List Products - * Retrieves a list of Products. - * @param q Query used for searching products by title, description, variant's title, variant's sku, and collection's title (optional) - * @param id product IDs to search for. (optional) - * @param salesChannelId an array of sales channel IDs to filter the retrieved products by. (optional) - * @param collectionId Collection IDs to search for (optional) - * @param typeId Type IDs to search for (optional) - * @param tags Tag IDs to search for (optional) - * @param title title to search for. (optional) - * @param description description to search for. (optional) - * @param handle handle to search for. (optional) - * @param isGiftcard Search for giftcards using is_giftcard=true. (optional) - * @param createdAt Date comparison for when resulting products were created. (optional) - * @param updatedAt Date comparison for when resulting products were updated. (optional) - * @param categoryId Category ids to filter by. (optional) - * @param includeCategoryChildren Include category children when filtering by category_id. (optional) - * @param offset How many products to skip in the result. (optional, default to 0) - * @param limit Limit the number of products returned. (optional, default to 100) - * @param expand (Comma separated) Which fields should be expanded in each product of the result. (optional) - * @param fields (Comma separated) Which fields should be included in each product of the result. (optional) - * @param order the field used to order the products. (optional) - * @param cartId The id of the Cart to set prices based on. (optional) - * @param regionId The id of the Region to set prices based on. (optional) - * @param currencyCode The currency code to use for price selection. (optional) - * @return ApiResponse<StoreProductsListRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getProductsWithHttpInfo(String q, Id id, List salesChannelId, List collectionId, List typeId, List tags, String title, String description, String handle, Boolean isGiftcard, CreatedAt4 createdAt, UpdatedAt4 updatedAt, List categoryId, Boolean includeCategoryChildren, Integer offset, Integer limit, String expand, String fields, String order, String cartId, String regionId, String currencyCode) throws ApiException { - com.squareup.okhttp.Call call = getProductsValidateBeforeCall(q, id, salesChannelId, collectionId, typeId, tags, title, description, handle, isGiftcard, createdAt, updatedAt, categoryId, includeCategoryChildren, offset, limit, expand, fields, order, cartId, regionId, currencyCode, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * List Products (asynchronously) - * Retrieves a list of Products. - * @param q Query used for searching products by title, description, variant's title, variant's sku, and collection's title (optional) - * @param id product IDs to search for. (optional) - * @param salesChannelId an array of sales channel IDs to filter the retrieved products by. (optional) - * @param collectionId Collection IDs to search for (optional) - * @param typeId Type IDs to search for (optional) - * @param tags Tag IDs to search for (optional) - * @param title title to search for. (optional) - * @param description description to search for. (optional) - * @param handle handle to search for. (optional) - * @param isGiftcard Search for giftcards using is_giftcard=true. (optional) - * @param createdAt Date comparison for when resulting products were created. (optional) - * @param updatedAt Date comparison for when resulting products were updated. (optional) - * @param categoryId Category ids to filter by. (optional) - * @param includeCategoryChildren Include category children when filtering by category_id. (optional) - * @param offset How many products to skip in the result. (optional, default to 0) - * @param limit Limit the number of products returned. (optional, default to 100) - * @param expand (Comma separated) Which fields should be expanded in each product of the result. (optional) - * @param fields (Comma separated) Which fields should be included in each product of the result. (optional) - * @param order the field used to order the products. (optional) - * @param cartId The id of the Cart to set prices based on. (optional) - * @param regionId The id of the Region to set prices based on. (optional) - * @param currencyCode The currency code to use for price selection. (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getProductsAsync(String q, Id id, List salesChannelId, List collectionId, List typeId, List tags, String title, String description, String handle, Boolean isGiftcard, CreatedAt4 createdAt, UpdatedAt4 updatedAt, List categoryId, Boolean includeCategoryChildren, Integer offset, Integer limit, String expand, String fields, String order, String cartId, String regionId, String currencyCode, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getProductsValidateBeforeCall(q, id, salesChannelId, collectionId, typeId, tags, title, description, handle, isGiftcard, createdAt, updatedAt, categoryId, includeCategoryChildren, offset, limit, expand, fields, order, cartId, regionId, currencyCode, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getProductsProduct - * @param id The id of the Product. (required) - * @param salesChannelId The sales channel used when fetching the product. (optional) - * @param cartId The ID of the customer's cart. (optional) - * @param regionId The ID of the region the customer is using. This is helpful to ensure correct prices are retrieved for a region. (optional) - * @param fields (Comma separated) Which fields should be included in the result. (optional) - * @param expand (Comma separated) Which fields should be expanded in each product of the result. (optional) - * @param currencyCode The 3 character ISO currency code to set prices based on. This is helpful to ensure correct prices are retrieved for a currency. (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getProductsProductCall(String id, String salesChannelId, String cartId, String regionId, String fields, String expand, String currencyCode, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/products/{id}" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - if (salesChannelId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("sales_channel_id", salesChannelId)); - if (cartId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("cart_id", cartId)); - if (regionId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("region_id", regionId)); - if (fields != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("fields", fields)); - if (expand != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("expand", expand)); - if (currencyCode != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("currency_code", currencyCode)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getProductsProductValidateBeforeCall(String id, String salesChannelId, String cartId, String regionId, String fields, String expand, String currencyCode, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling getProductsProduct(Async)"); - } - - com.squareup.okhttp.Call call = getProductsProductCall(id, salesChannelId, cartId, regionId, fields, expand, currencyCode, progressListener, progressRequestListener); - return call; - - - - - + public ListProductsRequest listProducts() throws ApiException { + return new ListProductsRequest(medusaSdkClient); } /** * Get a Product * Retrieves a Product. * @param id The id of the Product. (required) - * @param salesChannelId The sales channel used when fetching the product. (optional) - * @param cartId The ID of the customer's cart. (optional) - * @param regionId The ID of the region the customer is using. This is helpful to ensure correct prices are retrieved for a region. (optional) - * @param fields (Comma separated) Which fields should be included in the result. (optional) - * @param expand (Comma separated) Which fields should be expanded in each product of the result. (optional) - * @param currencyCode The 3 character ISO currency code to set prices based on. This is helpful to ensure correct prices are retrieved for a currency. (optional) + * salesChannelId The sales channel used when fetching the product. (optional) + * cartId The ID of the customer's cart. (optional) + * regionId The ID of the region the customer is using. This is helpful to ensure correct prices are retrieved for a region. (optional) + * fields (Comma separated) Which fields should be included in the result. (optional) + * expand (Comma separated) Which fields should be expanded in each product of the result. (optional) + * currencyCode The 3 character ISO currency code to set prices based on. This is helpful to ensure correct prices are retrieved for a currency. (optional) * @return StoreProductsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreProductsRes getProductsProduct(String id, String salesChannelId, String cartId, String regionId, String fields, String expand, String currencyCode) throws ApiException { - ApiResponse resp = getProductsProductWithHttpInfo(id, salesChannelId, cartId, regionId, fields, expand, currencyCode); - return resp.getData(); - } - - /** - * Get a Product - * Retrieves a Product. - * @param id The id of the Product. (required) - * @param salesChannelId The sales channel used when fetching the product. (optional) - * @param cartId The ID of the customer's cart. (optional) - * @param regionId The ID of the region the customer is using. This is helpful to ensure correct prices are retrieved for a region. (optional) - * @param fields (Comma separated) Which fields should be included in the result. (optional) - * @param expand (Comma separated) Which fields should be expanded in each product of the result. (optional) - * @param currencyCode The 3 character ISO currency code to set prices based on. This is helpful to ensure correct prices are retrieved for a currency. (optional) - * @return ApiResponse<StoreProductsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getProductsProductWithHttpInfo(String id, String salesChannelId, String cartId, String regionId, String fields, String expand, String currencyCode) throws ApiException { - com.squareup.okhttp.Call call = getProductsProductValidateBeforeCall(id, salesChannelId, cartId, regionId, fields, expand, currencyCode, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Get a Product (asynchronously) - * Retrieves a Product. - * @param id The id of the Product. (required) - * @param salesChannelId The sales channel used when fetching the product. (optional) - * @param cartId The ID of the customer's cart. (optional) - * @param regionId The ID of the region the customer is using. This is helpful to ensure correct prices are retrieved for a region. (optional) - * @param fields (Comma separated) Which fields should be included in the result. (optional) - * @param expand (Comma separated) Which fields should be expanded in each product of the result. (optional) - * @param currencyCode The 3 character ISO currency code to set prices based on. This is helpful to ensure correct prices are retrieved for a currency. (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getProductsProductAsync(String id, String salesChannelId, String cartId, String regionId, String fields, String expand, String currencyCode, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getProductsProductValidateBeforeCall(id, salesChannelId, cartId, regionId, fields, expand, currencyCode, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postProductsSearch - * @param q The query to run the search with. (required) - * @param offset How many products to skip in the result. (optional) - * @param limit Limit the number of products returned. (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postProductsSearchCall(String q, Integer offset, Integer limit, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/products/search"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - if (q != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("q", q)); - if (offset != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("offset", offset)); - if (limit != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("limit", limit)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postProductsSearchValidateBeforeCall(String q, Integer offset, Integer limit, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'q' is set - if (q == null) { - throw new ApiException("Missing the required parameter 'q' when calling postProductsSearch(Async)"); - } - - com.squareup.okhttp.Call call = postProductsSearchCall(q, offset, limit, progressListener, progressRequestListener); - return call; - - - - - + public GetProductRequest getProduct(String id) throws ApiException { + return new GetProductRequest(medusaSdkClient, id); } /** * Search Products * Run a search query on products using the search engine installed on Medusa * @param q The query to run the search with. (required) - * @param offset How many products to skip in the result. (optional) - * @param limit Limit the number of products returned. (optional) + * offset How many products to skip in the result. (optional) + * limit Limit the number of products returned. (optional) * @return StorePostSearchRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StorePostSearchRes postProductsSearch(String q, Integer offset, Integer limit) throws ApiException { - ApiResponse resp = postProductsSearchWithHttpInfo(q, offset, limit); - return resp.getData(); - } - - /** - * Search Products - * Run a search query on products using the search engine installed on Medusa - * @param q The query to run the search with. (required) - * @param offset How many products to skip in the result. (optional) - * @param limit Limit the number of products returned. (optional) - * @return ApiResponse<StorePostSearchRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postProductsSearchWithHttpInfo(String q, Integer offset, Integer limit) throws ApiException { - com.squareup.okhttp.Call call = postProductsSearchValidateBeforeCall(q, offset, limit, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Search Products (asynchronously) - * Run a search query on products using the search engine installed on Medusa - * @param q The query to run the search with. (required) - * @param offset How many products to skip in the result. (optional) - * @param limit Limit the number of products returned. (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postProductsSearchAsync(String q, Integer offset, Integer limit, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postProductsSearchValidateBeforeCall(q, offset, limit, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; + public SearchProductsRequest postProductsSearch(String q) throws ApiException { + return new SearchProductsRequest(medusaSdkClient, q); } } diff --git a/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java b/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java index 443788f..10dd2be 100644 --- a/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java +++ b/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java @@ -24,4 +24,16 @@ public class QueryParamConstant { public static final String CANCELED_AT = "canceled_at"; public static final String FIELDS = "fields"; public static final String EXPAND = "expand"; + public static final String SALES_CHANNEL_ID = "sales_channel_id"; + public static final String COLLECTION_ID = "collection_id"; + public static final String TYPE_ID = "type_id"; + public static final String TAGS = "tags"; + public static final String TITLE = "title"; + public static final String DESCRIPTION = "description"; + public static final String HANDLE = "handle"; + public static final String IS_GIFTCARD = "is_giftcard"; + public static final String CATEGORY_ID = "category_id"; + public static final String INCLUDE_CATEGORY_CHILDREN = "include_category_children"; + public static final String ORDER = "order"; + } diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/product/GetProductRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/product/GetProductRequest.java new file mode 100644 index 0000000..459ca33 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/product/GetProductRequest.java @@ -0,0 +1,107 @@ +package mobi.appcent.medusa.store.model.request.product; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.QueryParamConstant; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreProductsRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 10.03.2023 + */ +public class GetProductRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private String salesChannelId; + private String cartId; + private String regionId; + private String fields; + private String expand; + private String currencyCode; + + public GetProductRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + public GetProductRequest salesChannelId(String salesChannelId) { + this.salesChannelId = salesChannelId; + return this; + } + + public GetProductRequest cartId(String cartId) { + this.cartId = cartId; + return this; + } + + public GetProductRequest regionId(String regionId) { + this.regionId = regionId; + return this; + } + + public GetProductRequest fields(String fields) { + this.fields = fields; + return this; + } + + public GetProductRequest expand(String expand) { + this.expand = expand; + return this; + } + + public GetProductRequest currencyCode(String currencyCode) { + this.currencyCode = currencyCode; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.PRODUCT_PATH + "/" + id; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + List localVarQueryParams = new ArrayList(); + if (salesChannelId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.SALES_CHANNEL_ID, salesChannelId)); + if (cartId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CART_ID, cartId)); + if (regionId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.REGION_ID, regionId)); + if (fields != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.FIELDS, fields)); + if (expand != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.EXPAND, expand)); + if (currencyCode != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CURRENCY_CODE, currencyCode)); + + + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/product/ListProductsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/product/ListProductsRequest.java new file mode 100644 index 0000000..c9886ab --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/product/ListProductsRequest.java @@ -0,0 +1,234 @@ +package mobi.appcent.medusa.store.model.request.product; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.QueryParamConstant; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.CreatedAt4; +import mobi.appcent.medusa.store.model.response.Id; +import mobi.appcent.medusa.store.model.response.StoreProductsListRes; +import mobi.appcent.medusa.store.model.response.UpdatedAt4; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 10.03.2023 + */ +public class ListProductsRequest extends BaseRequest { + + private final MedusaSdkClient client; + private String q; + private Id id; + private List salesChannelId; + private List collectionId; + private List typeId; + private List tags; + private String title; + private String description; + private String handle; + private Boolean isGiftcard; + private CreatedAt4 createdAt; + private UpdatedAt4 updatedAt; + private List categoryId; + private Boolean includeCategoryChildren; + private Integer offset; + private Integer limit; + private String expand; + private String fields; + private String order; + private String cartId; + private String regionId; + private String currencyCode; + + public ListProductsRequest(MedusaSdkClient client) { + this.client = client; + } + + public ListProductsRequest q(String q) { + this.q = q; + return this; + } + + public ListProductsRequest id(Id id) { + this.id = id; + return this; + } + + public ListProductsRequest salesChannelId(List salesChannelId) { + this.salesChannelId = salesChannelId; + return this; + } + + public ListProductsRequest collectionId(List collectionId) { + this.collectionId = collectionId; + return this; + } + + public ListProductsRequest typeId(List typeId) { + this.typeId = typeId; + return this; + } + + public ListProductsRequest tags(List tags) { + this.tags = tags; + return this; + } + public ListProductsRequest title(String title) { + this.title = title; + return this; + } + + public ListProductsRequest description(String description) { + this.description = description; + return this; + } + public ListProductsRequest handle(String handle) { + this.handle = handle; + return this; + } + public ListProductsRequest isGiftcard(Boolean isGiftcard) { + this.isGiftcard = isGiftcard; + return this; + } + + public ListProductsRequest createdAt(CreatedAt4 createdAt) { + this.createdAt = createdAt; + return this; + } + + public ListProductsRequest updatedAt(UpdatedAt4 updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public ListProductsRequest categoryId(List categoryId) { + this.categoryId = categoryId; + return this; + } + + public ListProductsRequest includeCategoryChildren(Boolean includeCategoryChildren) { + this.includeCategoryChildren = includeCategoryChildren; + return this; + } + + public ListProductsRequest offset(Integer offset) { + this.offset = offset; + return this; + } + + public ListProductsRequest limit(Integer limit) { + this.limit = limit; + return this; + } + + public ListProductsRequest expand(String expand) { + this.expand = expand; + return this; + } + + public ListProductsRequest fields(String fields) { + this.fields = fields; + return this; + } + + public ListProductsRequest order(String order) { + this.order = order; + return this; + } + + public ListProductsRequest cartId(String cartId) { + this.cartId = cartId; + return this; + } + + public ListProductsRequest regionId(String regionId) { + this.regionId = regionId; + return this; + } + + public ListProductsRequest currencyCode(String currencyCode) { + this.currencyCode = currencyCode; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.PRODUCT_PATH; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (q != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.Q, q)); + if (id != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.ID, id)); + if (salesChannelId != null) + localVarCollectionQueryParams.addAll(client.parameterToPairs(QueryParamConstant.CSV_FORMAT, QueryParamConstant.SALES_CHANNEL_ID, salesChannelId)); + if (collectionId != null) + localVarCollectionQueryParams.addAll(client.parameterToPairs(QueryParamConstant.CSV_FORMAT, QueryParamConstant.COLLECTION_ID, collectionId)); + if (typeId != null) + localVarCollectionQueryParams.addAll(client.parameterToPairs(QueryParamConstant.CSV_FORMAT, QueryParamConstant.TYPE_ID, typeId)); + if (tags != null) + localVarCollectionQueryParams.addAll(client.parameterToPairs(QueryParamConstant.CSV_FORMAT, QueryParamConstant.TAGS, tags)); + if (title != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.TITLE, title)); + if (description != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.DESCRIPTION, description)); + if (handle != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.HANDLE, handle)); + if (isGiftcard != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.IS_GIFTCARD, isGiftcard)); + if (createdAt != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CREATED_AT, createdAt)); + if (updatedAt != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.UPDATED_AT, updatedAt)); + if (categoryId != null) + localVarCollectionQueryParams.addAll(client.parameterToPairs(QueryParamConstant.CSV_FORMAT, QueryParamConstant.CATEGORY_ID, categoryId)); + if (includeCategoryChildren != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.INCLUDE_CATEGORY_CHILDREN, includeCategoryChildren)); + if (offset != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.OFFSET, offset)); + if (limit != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.LIMIT, limit)); + if (expand != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.EXPAND, expand)); + if (fields != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.FIELDS, fields)); + if (order != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.ORDER, order)); + if (cartId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CART_ID, cartId)); + if (regionId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.REGION_ID, regionId)); + if (currencyCode != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CURRENCY_CODE, currencyCode)); + + + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, localVarCollectionQueryParams, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/product/SearchProductsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/product/SearchProductsRequest.java new file mode 100644 index 0000000..329a549 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/product/SearchProductsRequest.java @@ -0,0 +1,76 @@ +package mobi.appcent.medusa.store.model.request.product; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.QueryParamConstant; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StorePostSearchRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 10.03.2023 + */ +public class SearchProductsRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String q; + private Integer offset; + private Integer limit; + + public SearchProductsRequest(MedusaSdkClient client, String q) { + this.client = client; + this.q = q; + } + + public SearchProductsRequest offset(Integer offset) { + this.offset = offset; + return this; + } + + public SearchProductsRequest limit(Integer limit) { + this.limit = limit; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.PRODUCT_PATH + "/search"; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + List localVarQueryParams = new ArrayList(); + if (q != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.Q, q)); + if (offset != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.OFFSET, offset)); + if (limit != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.LIMIT, limit)); + + return client.buildCall(path, HttpMethod.POST, localVarQueryParams, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/test/java/mobi/appcent/medusa/store/api/ProductApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/ProductApiTest.java index 73b6958..081b553 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/ProductApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/ProductApiTest.java @@ -65,7 +65,7 @@ public void getProductsTest() throws Exception { String cartId = null; String regionId = null; String currencyCode = null; - StoreProductsListRes response = api.getProducts(q, id, salesChannelId, collectionId, typeId, tags, title, description, handle, isGiftcard, createdAt, updatedAt, categoryId, includeCategoryChildren, offset, limit, expand, fields, order, cartId, regionId, currencyCode); + StoreProductsListRes response = api.listProducts().execute().getData(); // TODO: test validations } @@ -86,7 +86,7 @@ public void getProductsProductTest() throws Exception { String fields = null; String expand = null; String currencyCode = null; - StoreProductsRes response = api.getProductsProduct(id, salesChannelId, cartId, regionId, fields, expand, currencyCode); + StoreProductsRes response = api.getProduct(id).execute().getData(); // TODO: test validations } @@ -103,7 +103,7 @@ public void postProductsSearchTest() throws Exception { String q = null; Integer offset = null; Integer limit = null; - StorePostSearchRes response = api.postProductsSearch(q, offset, limit); + StorePostSearchRes response = api.postProductsSearch(q).execute().getData(); // TODO: test validations } From 9f8e5f552c8e3f74c6b8f3a2829d9bb0b2c07c27 Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Fri, 10 Mar 2023 23:37:44 +0300 Subject: [PATCH 12/32] feat(product-category-api): Refactor product category api (#12) --- .../medusa/store/api/ProductCategoryApi.java | 273 +----------------- .../store/common/QueryParamConstant.java | 1 + .../GetProductCategoryRequest.java | 76 +++++ .../ListProductCategoriesRequest.java | 90 ++++++ .../store/api/ProductCategoryApiTest.java | 4 +- 5 files changed, 181 insertions(+), 263 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/productcategory/GetProductCategoryRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/productcategory/ListProductCategoriesRequest.java diff --git a/src/main/java/mobi/appcent/medusa/store/api/ProductCategoryApi.java b/src/main/java/mobi/appcent/medusa/store/api/ProductCategoryApi.java index 069d59b..e9702b2 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ProductCategoryApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ProductCategoryApi.java @@ -20,6 +20,8 @@ import java.io.IOException; +import mobi.appcent.medusa.store.model.request.productcategory.GetProductCategoryRequest; +import mobi.appcent.medusa.store.model.request.productcategory.ListProductCategoriesRequest; import mobi.appcent.medusa.store.model.response.StoreGetProductCategoriesCategoryRes; import mobi.appcent.medusa.store.model.response.StoreProductCategoriesListRes; @@ -42,283 +44,32 @@ public MedusaSdkClient getApiClient() { public void setApiClient(MedusaSdkClient medusaSdkClient) { this.medusaSdkClient = medusaSdkClient; - } - - /** - * Build call for getProductCategories - * @param q Query used for searching product category names orhandles. (optional) - * @param parentCategoryId Returns categories scoped by parent (optional) - * @param offset How many product categories to skip in the result. (optional, default to 0) - * @param limit Limit the number of product categories returned. (optional, default to 100) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getProductCategoriesCall(String q, String parentCategoryId, Integer offset, Integer limit, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/product-categories"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - if (q != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("q", q)); - if (parentCategoryId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("parent_category_id", parentCategoryId)); - if (offset != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("offset", offset)); - if (limit != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("limit", limit)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getProductCategoriesValidateBeforeCall(String q, String parentCategoryId, Integer offset, Integer limit, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = getProductCategoriesCall(q, parentCategoryId, offset, limit, progressListener, progressRequestListener); - return call; - - - - - } /** * List Product Categories * Retrieve a list of product categories. - * @param q Query used for searching product category names orhandles. (optional) - * @param parentCategoryId Returns categories scoped by parent (optional) - * @param offset How many product categories to skip in the result. (optional, default to 0) - * @param limit Limit the number of product categories returned. (optional, default to 100) + * q Query used for searching product category names orhandles. (optional) + * parentCategoryId Returns categories scoped by parent (optional) + * offset How many product categories to skip in the result. (optional, default to 0) + * limit Limit the number of product categories returned. (optional, default to 100) * @return StoreProductCategoriesListRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreProductCategoriesListRes getProductCategories(String q, String parentCategoryId, Integer offset, Integer limit) throws ApiException { - ApiResponse resp = getProductCategoriesWithHttpInfo(q, parentCategoryId, offset, limit); - return resp.getData(); - } - - /** - * List Product Categories - * Retrieve a list of product categories. - * @param q Query used for searching product category names orhandles. (optional) - * @param parentCategoryId Returns categories scoped by parent (optional) - * @param offset How many product categories to skip in the result. (optional, default to 0) - * @param limit Limit the number of product categories returned. (optional, default to 100) - * @return ApiResponse<StoreProductCategoriesListRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getProductCategoriesWithHttpInfo(String q, String parentCategoryId, Integer offset, Integer limit) throws ApiException { - com.squareup.okhttp.Call call = getProductCategoriesValidateBeforeCall(q, parentCategoryId, offset, limit, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * List Product Categories (asynchronously) - * Retrieve a list of product categories. - * @param q Query used for searching product category names orhandles. (optional) - * @param parentCategoryId Returns categories scoped by parent (optional) - * @param offset How many product categories to skip in the result. (optional, default to 0) - * @param limit Limit the number of product categories returned. (optional, default to 100) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getProductCategoriesAsync(String q, String parentCategoryId, Integer offset, Integer limit, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getProductCategoriesValidateBeforeCall(q, parentCategoryId, offset, limit, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getProductCategoriesCategory - * @param id The ID of the Product Category (required) - * @param expand (Comma separated) Which fields should be expanded in each product category. (optional) - * @param fields (Comma separated) Which fields should be retrieved in each product category. (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getProductCategoriesCategoryCall(String id, String expand, String fields, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/product-categories/{id}" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - if (expand != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("expand", expand)); - if (fields != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("fields", fields)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getProductCategoriesCategoryValidateBeforeCall(String id, String expand, String fields, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling getProductCategoriesCategory(Async)"); - } - - com.squareup.okhttp.Call call = getProductCategoriesCategoryCall(id, expand, fields, progressListener, progressRequestListener); - return call; - - - - - + public ListProductCategoriesRequest listProductCategories() throws ApiException { + return new ListProductCategoriesRequest(medusaSdkClient); } /** * Get a Product Category * Retrieves a Product Category. * @param id The ID of the Product Category (required) - * @param expand (Comma separated) Which fields should be expanded in each product category. (optional) - * @param fields (Comma separated) Which fields should be retrieved in each product category. (optional) + * expand (Comma separated) Which fields should be expanded in each product category. (optional) + * fields (Comma separated) Which fields should be retrieved in each product category. (optional) * @return StoreGetProductCategoriesCategoryRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreGetProductCategoriesCategoryRes getProductCategoriesCategory(String id, String expand, String fields) throws ApiException { - ApiResponse resp = getProductCategoriesCategoryWithHttpInfo(id, expand, fields); - return resp.getData(); - } - - /** - * Get a Product Category - * Retrieves a Product Category. - * @param id The ID of the Product Category (required) - * @param expand (Comma separated) Which fields should be expanded in each product category. (optional) - * @param fields (Comma separated) Which fields should be retrieved in each product category. (optional) - * @return ApiResponse<StoreGetProductCategoriesCategoryRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getProductCategoriesCategoryWithHttpInfo(String id, String expand, String fields) throws ApiException { - com.squareup.okhttp.Call call = getProductCategoriesCategoryValidateBeforeCall(id, expand, fields, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Get a Product Category (asynchronously) - * Retrieves a Product Category. - * @param id The ID of the Product Category (required) - * @param expand (Comma separated) Which fields should be expanded in each product category. (optional) - * @param fields (Comma separated) Which fields should be retrieved in each product category. (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getProductCategoriesCategoryAsync(String id, String expand, String fields, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getProductCategoriesCategoryValidateBeforeCall(id, expand, fields, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; + public GetProductCategoryRequest getProductCategoriesCategory(String id) throws ApiException { + return new GetProductCategoryRequest(medusaSdkClient, id); } } diff --git a/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java b/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java index 10dd2be..0ab3c67 100644 --- a/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java +++ b/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java @@ -35,5 +35,6 @@ public class QueryParamConstant { public static final String CATEGORY_ID = "category_id"; public static final String INCLUDE_CATEGORY_CHILDREN = "include_category_children"; public static final String ORDER = "order"; + public static final String PARENT_CATEGORY_ID = "parent_category_id"; } diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/productcategory/GetProductCategoryRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/productcategory/GetProductCategoryRequest.java new file mode 100644 index 0000000..823b1ae --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/productcategory/GetProductCategoryRequest.java @@ -0,0 +1,76 @@ +package mobi.appcent.medusa.store.model.request.productcategory; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.QueryParamConstant; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreGetProductCategoriesCategoryRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 10.03.2023 + */ +public class GetProductCategoryRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + private String expand; + private String fields; + + public GetProductCategoryRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + public GetProductCategoryRequest expand(String expand) { + this.expand = expand; + return this; + } + + public GetProductCategoryRequest fields(String fields) { + this.fields = fields; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.PRODUCT_CATEGORY_PATH + "/" + id; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + List localVarQueryParams = new ArrayList(); + if (expand != null) + localVarQueryParams.addAll(client.parameterToPair("expand", expand)); + if (fields != null) + localVarQueryParams.addAll(client.parameterToPair("fields", fields)); + + + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/productcategory/ListProductCategoriesRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/productcategory/ListProductCategoriesRequest.java new file mode 100644 index 0000000..90f65fe --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/productcategory/ListProductCategoriesRequest.java @@ -0,0 +1,90 @@ +package mobi.appcent.medusa.store.model.request.productcategory; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.QueryParamConstant; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreProductCategoriesListRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 10.03.2023 + */ +public class ListProductCategoriesRequest extends BaseRequest { + + private final MedusaSdkClient client; + private String q; + private String parentCategoryId; + private Integer offset; + private Integer limit; + + public ListProductCategoriesRequest(MedusaSdkClient client) { + this.client = client; + } + + public ListProductCategoriesRequest q(String q) { + this.q = q; + return this; + } + + public ListProductCategoriesRequest parentCategoryId(String parentCategoryId) { + this.parentCategoryId = parentCategoryId; + return this; + } + + public ListProductCategoriesRequest offset(Integer offset) { + this.offset = offset; + return this; + } + + public ListProductCategoriesRequest limit(Integer limit) { + this.limit = limit; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.PRODUCT_CATEGORY_PATH; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + List localVarQueryParams = new ArrayList(); + if (q != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.Q, q)); + if (parentCategoryId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.PARENT_CATEGORY_ID, parentCategoryId)); + if (offset != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.OFFSET, offset)); + if (limit != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.LIMIT, limit)); + + + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/test/java/mobi/appcent/medusa/store/api/ProductCategoryApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/ProductCategoryApiTest.java index 3bf4bc3..7e40075 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/ProductCategoryApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/ProductCategoryApiTest.java @@ -40,7 +40,7 @@ public void getProductCategoriesTest() throws Exception { String parentCategoryId = null; Integer offset = null; Integer limit = null; - StoreProductCategoriesListRes response = api.getProductCategories(q, parentCategoryId, offset, limit); + StoreProductCategoriesListRes response = api.listProductCategories().execute().getData(); // TODO: test validations } @@ -57,7 +57,7 @@ public void getProductCategoriesCategoryTest() throws Exception { String id = null; String expand = null; String fields = null; - StoreGetProductCategoriesCategoryRes response = api.getProductCategoriesCategory(id, expand, fields); + StoreGetProductCategoriesCategoryRes response = api.getProductCategoriesCategory(id).execute().getData(); // TODO: test validations } From 7fd7fccde7e7b828036fb531e1e13f57f82b8eeb Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Fri, 10 Mar 2023 23:39:21 +0300 Subject: [PATCH 13/32] feat(product-tags-api): Refactor product tags api (#13) --- .../medusa/store/api/ProductTagApi.java | 175 ++---------------- .../store/common/QueryParamConstant.java | 2 + .../producttag/ListProductTagsRequest.java | 132 +++++++++++++ .../medusa/store/api/ProductTagApiTest.java | 2 +- 4 files changed, 147 insertions(+), 164 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/producttag/ListProductTagsRequest.java diff --git a/src/main/java/mobi/appcent/medusa/store/api/ProductTagApi.java b/src/main/java/mobi/appcent/medusa/store/api/ProductTagApi.java index 0adcaa5..6a78a9e 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ProductTagApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ProductTagApi.java @@ -20,6 +20,7 @@ import java.io.IOException; +import mobi.appcent.medusa.store.model.request.producttag.ListProductTagsRequest; import mobi.appcent.medusa.store.model.response.CreatedAt2; import mobi.appcent.medusa.store.model.response.InlineResponse200; import mobi.appcent.medusa.store.model.response.UpdatedAt2; @@ -43,176 +44,24 @@ public MedusaSdkClient getApiClient() { public void setApiClient(MedusaSdkClient medusaSdkClient) { this.medusaSdkClient = medusaSdkClient; - } - - /** - * Build call for getProductTags - * @param limit The number of types to return. (optional, default to 20) - * @param offset The number of items to skip before the results. (optional, default to 0) - * @param order The field to sort items by. (optional) - * @param discountConditionId The discount condition id on which to filter the product tags. (optional) - * @param value The tag values to search for (optional) - * @param id The tag IDs to search for (optional) - * @param q A query string to search values for (optional) - * @param createdAt Date comparison for when resulting product tags were created. (optional) - * @param updatedAt Date comparison for when resulting product tags were updated. (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getProductTagsCall(Integer limit, Integer offset, String order, String discountConditionId, List value, List id, String q, CreatedAt2 createdAt, UpdatedAt2 updatedAt, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/product-tags"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - if (limit != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("limit", limit)); - if (offset != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("offset", offset)); - if (order != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("order", order)); - if (discountConditionId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("discount_condition_id", discountConditionId)); - if (value != null) - localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "value", value)); - if (id != null) - localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "id", id)); - if (q != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("q", q)); - if (createdAt != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("created_at", createdAt)); - if (updatedAt != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("updated_at", updatedAt)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getProductTagsValidateBeforeCall(Integer limit, Integer offset, String order, String discountConditionId, List value, List id, String q, CreatedAt2 createdAt, UpdatedAt2 updatedAt, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = getProductTagsCall(limit, offset, order, discountConditionId, value, id, q, createdAt, updatedAt, progressListener, progressRequestListener); - return call; - - - - - } /** * List Product Tags * Retrieve a list of Product Tags. - * @param limit The number of types to return. (optional, default to 20) - * @param offset The number of items to skip before the results. (optional, default to 0) - * @param order The field to sort items by. (optional) - * @param discountConditionId The discount condition id on which to filter the product tags. (optional) - * @param value The tag values to search for (optional) - * @param id The tag IDs to search for (optional) - * @param q A query string to search values for (optional) - * @param createdAt Date comparison for when resulting product tags were created. (optional) - * @param updatedAt Date comparison for when resulting product tags were updated. (optional) + * limit The number of types to return. (optional, default to 20) + * offset The number of items to skip before the results. (optional, default to 0) + * order The field to sort items by. (optional) + * discountConditionId The discount condition id on which to filter the product tags. (optional) + * value The tag values to search for (optional) + * id The tag IDs to search for (optional) + * q A query string to search values for (optional) + * createdAt Date comparison for when resulting product tags were created. (optional) + * updatedAt Date comparison for when resulting product tags were updated. (optional) * @return InlineResponse200 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public InlineResponse200 getProductTags(Integer limit, Integer offset, String order, String discountConditionId, List value, List id, String q, CreatedAt2 createdAt, UpdatedAt2 updatedAt) throws ApiException { - ApiResponse resp = getProductTagsWithHttpInfo(limit, offset, order, discountConditionId, value, id, q, createdAt, updatedAt); - return resp.getData(); - } - - /** - * List Product Tags - * Retrieve a list of Product Tags. - * @param limit The number of types to return. (optional, default to 20) - * @param offset The number of items to skip before the results. (optional, default to 0) - * @param order The field to sort items by. (optional) - * @param discountConditionId The discount condition id on which to filter the product tags. (optional) - * @param value The tag values to search for (optional) - * @param id The tag IDs to search for (optional) - * @param q A query string to search values for (optional) - * @param createdAt Date comparison for when resulting product tags were created. (optional) - * @param updatedAt Date comparison for when resulting product tags were updated. (optional) - * @return ApiResponse<InlineResponse200> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getProductTagsWithHttpInfo(Integer limit, Integer offset, String order, String discountConditionId, List value, List id, String q, CreatedAt2 createdAt, UpdatedAt2 updatedAt) throws ApiException { - com.squareup.okhttp.Call call = getProductTagsValidateBeforeCall(limit, offset, order, discountConditionId, value, id, q, createdAt, updatedAt, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * List Product Tags (asynchronously) - * Retrieve a list of Product Tags. - * @param limit The number of types to return. (optional, default to 20) - * @param offset The number of items to skip before the results. (optional, default to 0) - * @param order The field to sort items by. (optional) - * @param discountConditionId The discount condition id on which to filter the product tags. (optional) - * @param value The tag values to search for (optional) - * @param id The tag IDs to search for (optional) - * @param q A query string to search values for (optional) - * @param createdAt Date comparison for when resulting product tags were created. (optional) - * @param updatedAt Date comparison for when resulting product tags were updated. (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getProductTagsAsync(Integer limit, Integer offset, String order, String discountConditionId, List value, List id, String q, CreatedAt2 createdAt, UpdatedAt2 updatedAt, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getProductTagsValidateBeforeCall(limit, offset, order, discountConditionId, value, id, q, createdAt, updatedAt, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; + public ListProductTagsRequest getProductTags() throws ApiException { + return new ListProductTagsRequest(medusaSdkClient); } } diff --git a/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java b/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java index 0ab3c67..c5bdf1c 100644 --- a/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java +++ b/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java @@ -35,6 +35,8 @@ public class QueryParamConstant { public static final String CATEGORY_ID = "category_id"; public static final String INCLUDE_CATEGORY_CHILDREN = "include_category_children"; public static final String ORDER = "order"; + public static final String DISCOUNT_CONDITION_ID = "discount_condition_id"; + public static final String VALUE = "value"; public static final String PARENT_CATEGORY_ID = "parent_category_id"; } diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/producttag/ListProductTagsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/producttag/ListProductTagsRequest.java new file mode 100644 index 0000000..06575be --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/producttag/ListProductTagsRequest.java @@ -0,0 +1,132 @@ +package mobi.appcent.medusa.store.model.request.producttag; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.QueryParamConstant; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.CreatedAt2; +import mobi.appcent.medusa.store.model.response.InlineResponse200; +import mobi.appcent.medusa.store.model.response.UpdatedAt2; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 10.03.2023 + */ +public class ListProductTagsRequest extends BaseRequest { + + private final MedusaSdkClient client; + private Integer limit; + private Integer offset; + private String order; + private String discountConditionId; + private List value; + private List id; + private String q; + private CreatedAt2 createdAt; + private UpdatedAt2 updatedAt; + + public ListProductTagsRequest(MedusaSdkClient client) { + this.client = client; + } + + public ListProductTagsRequest limit(Integer limit) { + this.limit = limit; + return this; + } + + public ListProductTagsRequest offset(Integer offset) { + this.offset = offset; + return this; + } + + public ListProductTagsRequest order(String order) { + this.order = order; + return this; + } + + public ListProductTagsRequest discountConditionId(String discountConditionId) { + this.discountConditionId = discountConditionId; + return this; + } + + public ListProductTagsRequest value(List value) { + this.value = value; + return this; + } + + public ListProductTagsRequest id(List id) { + this.id = id; + return this; + } + + public ListProductTagsRequest q(String q) { + this.q = q; + return this; + } + + public ListProductTagsRequest createdAt(CreatedAt2 createdAt) { + this.createdAt = createdAt; + return this; + } + + public ListProductTagsRequest updatedAt(UpdatedAt2 updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.PRODUCT_TAG_PATH; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (limit != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.LIMIT, limit)); + if (offset != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.OFFSET, offset)); + if (order != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.ORDER, order)); + if (discountConditionId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.DISCOUNT_CONDITION_ID, discountConditionId)); + if (value != null) + localVarCollectionQueryParams.addAll(client.parameterToPairs(QueryParamConstant.CSV_FORMAT, QueryParamConstant.VALUE, value)); + if (id != null) + localVarCollectionQueryParams.addAll(client.parameterToPairs(QueryParamConstant.CSV_FORMAT, QueryParamConstant.ID, id)); + if (q != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.Q, q)); + if (createdAt != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CREATED_AT, createdAt)); + if (updatedAt != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.UPDATED_AT, updatedAt)); + + + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, localVarCollectionQueryParams, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/test/java/mobi/appcent/medusa/store/api/ProductTagApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/ProductTagApiTest.java index 7a9614c..34004e7 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/ProductTagApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/ProductTagApiTest.java @@ -49,7 +49,7 @@ public void getProductTagsTest() throws Exception { String q = null; CreatedAt2 createdAt = null; UpdatedAt2 updatedAt = null; - InlineResponse200 response = api.getProductTags(limit, offset, order, discountConditionId, value, id, q, createdAt, updatedAt); + InlineResponse200 response = api.getProductTags().execute().getData(); // TODO: test validations } From c1fdd9fbe7fd96795ab0ede8c1104d9f446de873 Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Sat, 11 Mar 2023 14:58:01 +0300 Subject: [PATCH 14/32] feat(return-reason-api): Refactor return reason api (#14) --- .../medusa/store/api/ReturnReasonApi.java | 231 +----------------- .../returnreason/GetReturnReasonRequest.java | 55 +++++ .../returnreason/ListReturnReasonRequest.java | 53 ++++ .../medusa/store/api/ReturnReasonApiTest.java | 4 +- 4 files changed, 116 insertions(+), 227 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/returnreason/GetReturnReasonRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/returnreason/ListReturnReasonRequest.java diff --git a/src/main/java/mobi/appcent/medusa/store/api/ReturnReasonApi.java b/src/main/java/mobi/appcent/medusa/store/api/ReturnReasonApi.java index 3966780..1c8e0ac 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ReturnReasonApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ReturnReasonApi.java @@ -20,6 +20,8 @@ import java.io.IOException; +import mobi.appcent.medusa.store.model.request.returnreason.GetReturnReasonRequest; +import mobi.appcent.medusa.store.model.request.returnreason.ListReturnReasonRequest; import mobi.appcent.medusa.store.model.response.StoreReturnReasonsListRes; import mobi.appcent.medusa.store.model.response.StoreReturnReasonsRes; @@ -42,66 +44,6 @@ public MedusaSdkClient getApiClient() { public void setApiClient(MedusaSdkClient medusaSdkClient) { this.medusaSdkClient = medusaSdkClient; - } - - /** - * Build call for getReturnReasons - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getReturnReasonsCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/return-reasons"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getReturnReasonsValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = getReturnReasonsCall(progressListener, progressRequestListener); - return call; - - - - - } /** @@ -110,120 +52,8 @@ private com.squareup.okhttp.Call getReturnReasonsValidateBeforeCall(final Progre * @return StoreReturnReasonsListRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreReturnReasonsListRes getReturnReasons() throws ApiException { - ApiResponse resp = getReturnReasonsWithHttpInfo(); - return resp.getData(); - } - - /** - * List Return Reasons - * Retrieves a list of Return Reasons. - * @return ApiResponse<StoreReturnReasonsListRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getReturnReasonsWithHttpInfo() throws ApiException { - com.squareup.okhttp.Call call = getReturnReasonsValidateBeforeCall(null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * List Return Reasons (asynchronously) - * Retrieves a list of Return Reasons. - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getReturnReasonsAsync(final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getReturnReasonsValidateBeforeCall(progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getReturnReasonsReason - * @param id The id of the Return Reason. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getReturnReasonsReasonCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/return-reasons/{id}" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getReturnReasonsReasonValidateBeforeCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling getReturnReasonsReason(Async)"); - } - - com.squareup.okhttp.Call call = getReturnReasonsReasonCall(id, progressListener, progressRequestListener); - return call; - - - - - + public ListReturnReasonRequest listReturnReason() throws ApiException { + return new ListReturnReasonRequest(medusaSdkClient); } /** @@ -233,56 +63,7 @@ private com.squareup.okhttp.Call getReturnReasonsReasonValidateBeforeCall(String * @return StoreReturnReasonsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreReturnReasonsRes getReturnReasonsReason(String id) throws ApiException { - ApiResponse resp = getReturnReasonsReasonWithHttpInfo(id); - return resp.getData(); - } - - /** - * Get a Return Reason - * Retrieves a Return Reason. - * @param id The id of the Return Reason. (required) - * @return ApiResponse<StoreReturnReasonsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getReturnReasonsReasonWithHttpInfo(String id) throws ApiException { - com.squareup.okhttp.Call call = getReturnReasonsReasonValidateBeforeCall(id, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Get a Return Reason (asynchronously) - * Retrieves a Return Reason. - * @param id The id of the Return Reason. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getReturnReasonsReasonAsync(String id, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getReturnReasonsReasonValidateBeforeCall(id, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; + public GetReturnReasonRequest getReturnReason(String id) throws ApiException { + return new GetReturnReasonRequest(medusaSdkClient, id); } } diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/returnreason/GetReturnReasonRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/returnreason/GetReturnReasonRequest.java new file mode 100644 index 0000000..e288033 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/returnreason/GetReturnReasonRequest.java @@ -0,0 +1,55 @@ +package mobi.appcent.medusa.store.model.request.returnreason; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreReturnReasonsRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 11.03.2023 + */ +public class GetReturnReasonRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + + public GetReturnReasonRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.RETURN_REASON_PATH + "/" + id; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/returnreason/ListReturnReasonRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/returnreason/ListReturnReasonRequest.java new file mode 100644 index 0000000..459e5a1 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/returnreason/ListReturnReasonRequest.java @@ -0,0 +1,53 @@ +package mobi.appcent.medusa.store.model.request.returnreason; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreReturnReasonsListRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 11.03.2023 + */ +public class ListReturnReasonRequest extends BaseRequest { + + private final MedusaSdkClient client; + + public ListReturnReasonRequest(MedusaSdkClient client) { + this.client = client; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.RETURN_REASON_PATH; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/test/java/mobi/appcent/medusa/store/api/ReturnReasonApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/ReturnReasonApiTest.java index b65eca5..5a008d8 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/ReturnReasonApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/ReturnReasonApiTest.java @@ -36,7 +36,7 @@ public class ReturnReasonApiTest { */ @Test public void getReturnReasonsTest() throws Exception { - StoreReturnReasonsListRes response = api.getReturnReasons(); + StoreReturnReasonsListRes response = api.listReturnReason().execute().getData(); // TODO: test validations } @@ -51,7 +51,7 @@ public void getReturnReasonsTest() throws Exception { @Test public void getReturnReasonsReasonTest() throws Exception { String id = null; - StoreReturnReasonsRes response = api.getReturnReasonsReason(id); + StoreReturnReasonsRes response = api.getReturnReason(id).execute().getData(); // TODO: test validations } From 815bdfe778446705e8a498ede98ae04041a57d2b Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Sat, 11 Mar 2023 14:58:30 +0300 Subject: [PATCH 15/32] feat(shipping-options-api): Refactor shipping options api (#15) --- .../medusa/store/api/ShippingOptionApi.java | 251 +----------------- .../store/common/QueryParamConstant.java | 2 + .../GetShippingOptionsByCartIdRequest.java | 51 ++++ .../GetShippingOptionsRequest.java | 81 ++++++ .../store/api/ShippingOptionApiTest.java | 4 +- 5 files changed, 145 insertions(+), 244 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/shippingoption/GetShippingOptionsByCartIdRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/shippingoption/GetShippingOptionsRequest.java diff --git a/src/main/java/mobi/appcent/medusa/store/api/ShippingOptionApi.java b/src/main/java/mobi/appcent/medusa/store/api/ShippingOptionApi.java index 6a549dd..1ea3d85 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ShippingOptionApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ShippingOptionApi.java @@ -19,6 +19,8 @@ import java.io.IOException; +import mobi.appcent.medusa.store.model.request.shippingoption.GetShippingOptionsByCartIdRequest; +import mobi.appcent.medusa.store.model.request.shippingoption.GetShippingOptionsRequest; import mobi.appcent.medusa.store.model.response.StoreShippingOptionsListRes; import java.lang.reflect.Type; @@ -40,206 +42,19 @@ public MedusaSdkClient getApiClient() { public void setApiClient(MedusaSdkClient medusaSdkClient) { this.medusaSdkClient = medusaSdkClient; - } - - /** - * Build call for getShippingOptions - * @param isReturn Whether return Shipping Options should be included. By default all Shipping Options are returned. (optional) - * @param productIds A comma separated list of Product ids to filter Shipping Options by. (optional) - * @param regionId the Region to retrieve Shipping Options from. (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getShippingOptionsCall(Boolean isReturn, String productIds, String regionId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/shipping-options"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - if (isReturn != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("is_return", isReturn)); - if (productIds != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("product_ids", productIds)); - if (regionId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("region_id", regionId)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getShippingOptionsValidateBeforeCall(Boolean isReturn, String productIds, String regionId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = getShippingOptionsCall(isReturn, productIds, regionId, progressListener, progressRequestListener); - return call; - - - - - } /** * Get Shipping Options * Retrieves a list of Shipping Options. - * @param isReturn Whether return Shipping Options should be included. By default all Shipping Options are returned. (optional) - * @param productIds A comma separated list of Product ids to filter Shipping Options by. (optional) - * @param regionId the Region to retrieve Shipping Options from. (optional) + * isReturn Whether return Shipping Options should be included. By default all Shipping Options are returned. (optional) + * productIds A comma separated list of Product ids to filter Shipping Options by. (optional) + * regionId the Region to retrieve Shipping Options from. (optional) * @return StoreShippingOptionsListRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreShippingOptionsListRes getShippingOptions(Boolean isReturn, String productIds, String regionId) throws ApiException { - ApiResponse resp = getShippingOptionsWithHttpInfo(isReturn, productIds, regionId); - return resp.getData(); - } - - /** - * Get Shipping Options - * Retrieves a list of Shipping Options. - * @param isReturn Whether return Shipping Options should be included. By default all Shipping Options are returned. (optional) - * @param productIds A comma separated list of Product ids to filter Shipping Options by. (optional) - * @param regionId the Region to retrieve Shipping Options from. (optional) - * @return ApiResponse<StoreShippingOptionsListRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getShippingOptionsWithHttpInfo(Boolean isReturn, String productIds, String regionId) throws ApiException { - com.squareup.okhttp.Call call = getShippingOptionsValidateBeforeCall(isReturn, productIds, regionId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Get Shipping Options (asynchronously) - * Retrieves a list of Shipping Options. - * @param isReturn Whether return Shipping Options should be included. By default all Shipping Options are returned. (optional) - * @param productIds A comma separated list of Product ids to filter Shipping Options by. (optional) - * @param regionId the Region to retrieve Shipping Options from. (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getShippingOptionsAsync(Boolean isReturn, String productIds, String regionId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getShippingOptionsValidateBeforeCall(isReturn, productIds, regionId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getShippingOptionsCartId - * @param cartId The id of the Cart. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getShippingOptionsCartIdCall(String cartId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/shipping-options/{cart_id}" - .replaceAll("\\{" + "cart_id" + "\\}", medusaSdkClient.escapeString(cartId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getShippingOptionsCartIdValidateBeforeCall(String cartId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'cartId' is set - if (cartId == null) { - throw new ApiException("Missing the required parameter 'cartId' when calling getShippingOptionsCartId(Async)"); - } - - com.squareup.okhttp.Call call = getShippingOptionsCartIdCall(cartId, progressListener, progressRequestListener); - return call; - - - - - + public GetShippingOptionsRequest getShippingOptions() throws ApiException { + return new GetShippingOptionsRequest(medusaSdkClient); } /** @@ -249,56 +64,8 @@ private com.squareup.okhttp.Call getShippingOptionsCartIdValidateBeforeCall(Stri * @return StoreShippingOptionsListRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreShippingOptionsListRes getShippingOptionsCartId(String cartId) throws ApiException { - ApiResponse resp = getShippingOptionsCartIdWithHttpInfo(cartId); - return resp.getData(); + public GetShippingOptionsByCartIdRequest getShippingOptionsByCartId(String cartId) throws ApiException { + return new GetShippingOptionsByCartIdRequest(medusaSdkClient, cartId); } - /** - * List for Cart - * Retrieves a list of Shipping Options available to a cart. - * @param cartId The id of the Cart. (required) - * @return ApiResponse<StoreShippingOptionsListRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getShippingOptionsCartIdWithHttpInfo(String cartId) throws ApiException { - com.squareup.okhttp.Call call = getShippingOptionsCartIdValidateBeforeCall(cartId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * List for Cart (asynchronously) - * Retrieves a list of Shipping Options available to a cart. - * @param cartId The id of the Cart. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getShippingOptionsCartIdAsync(String cartId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getShippingOptionsCartIdValidateBeforeCall(cartId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } } diff --git a/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java b/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java index c5bdf1c..22a7091 100644 --- a/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java +++ b/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java @@ -38,5 +38,7 @@ public class QueryParamConstant { public static final String DISCOUNT_CONDITION_ID = "discount_condition_id"; public static final String VALUE = "value"; public static final String PARENT_CATEGORY_ID = "parent_category_id"; + public static final String IS_RETURN = "is_return"; + public static final String PRODUCT_IDS = "product_ids"; } diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/shippingoption/GetShippingOptionsByCartIdRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/shippingoption/GetShippingOptionsByCartIdRequest.java new file mode 100644 index 0000000..3b790f6 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/shippingoption/GetShippingOptionsByCartIdRequest.java @@ -0,0 +1,51 @@ +package mobi.appcent.medusa.store.model.request.shippingoption; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreShippingOptionsListRes; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by erenalpaslan on 11.03.2023 + */ +public class GetShippingOptionsByCartIdRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String cartId; + + public GetShippingOptionsByCartIdRequest(MedusaSdkClient client, String cartId) { + this.client = client; + this.cartId = cartId; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.SHIPPING_OPTION_PATH + "/" + cartId; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/shippingoption/GetShippingOptionsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/shippingoption/GetShippingOptionsRequest.java new file mode 100644 index 0000000..9039bf3 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/shippingoption/GetShippingOptionsRequest.java @@ -0,0 +1,81 @@ +package mobi.appcent.medusa.store.model.request.shippingoption; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.QueryParamConstant; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreShippingOptionsListRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 11.03.2023 + */ +public class GetShippingOptionsRequest extends BaseRequest { + + private final MedusaSdkClient client; + private Boolean isReturn; + private String productIds; + private String regionId; + + public GetShippingOptionsRequest(MedusaSdkClient client) { + this.client = client; + } + + public GetShippingOptionsRequest isReturn(Boolean isReturn) { + this.isReturn = isReturn; + return this; + } + + public GetShippingOptionsRequest productIds(String productIds) { + this.productIds = productIds; + return this; + } + + public GetShippingOptionsRequest regionId(String regionId) { + this.regionId = regionId; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.SHIPPING_OPTION_PATH; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + List localVarQueryParams = new ArrayList(); + if (isReturn != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.IS_RETURN, isReturn)); + if (productIds != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.PRODUCT_IDS, productIds)); + if (regionId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.REGION_ID, regionId)); + + + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/test/java/mobi/appcent/medusa/store/api/ShippingOptionApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/ShippingOptionApiTest.java index 3df9096..4335920 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/ShippingOptionApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/ShippingOptionApiTest.java @@ -38,7 +38,7 @@ public void getShippingOptionsTest() throws Exception { Boolean isReturn = null; String productIds = null; String regionId = null; - StoreShippingOptionsListRes response = api.getShippingOptions(isReturn, productIds, regionId); + StoreShippingOptionsListRes response = api.getShippingOptions().execute().getData(); // TODO: test validations } @@ -53,7 +53,7 @@ public void getShippingOptionsTest() throws Exception { @Test public void getShippingOptionsCartIdTest() throws Exception { String cartId = null; - StoreShippingOptionsListRes response = api.getShippingOptionsCartId(cartId); + StoreShippingOptionsListRes response = api.getShippingOptionsByCartId(cartId).execute().getData(); // TODO: test validations } From cc7e5317cbdedbbf4657600a6c4e699b6c38ab48 Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Sat, 11 Mar 2023 14:58:53 +0300 Subject: [PATCH 16/32] feat(return-api): Refactor return api (#16) --- .../appcent/medusa/store/api/ReturnApi.java | 115 +----------------- .../request/returns/CreateReturnRequest.java | 60 +++++++++ 2 files changed, 63 insertions(+), 112 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/returns/CreateReturnRequest.java diff --git a/src/main/java/mobi/appcent/medusa/store/api/ReturnApi.java b/src/main/java/mobi/appcent/medusa/store/api/ReturnApi.java index 8ac1334..dc73ffb 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ReturnApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ReturnApi.java @@ -19,6 +19,7 @@ import java.io.IOException; +import mobi.appcent.medusa.store.model.request.returns.CreateReturnRequest; import mobi.appcent.medusa.store.model.response.StorePostReturnsReq; import mobi.appcent.medusa.store.model.response.StoreReturnsRes; @@ -41,67 +42,6 @@ public MedusaSdkClient getApiClient() { public void setApiClient(MedusaSdkClient medusaSdkClient) { this.medusaSdkClient = medusaSdkClient; - } - - /** - * Build call for postReturns - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postReturnsCall(StorePostReturnsReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/returns"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postReturnsValidateBeforeCall(StorePostReturnsReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = postReturnsCall(body, progressListener, progressRequestListener); - return call; - - - - - } /** @@ -111,56 +51,7 @@ private com.squareup.okhttp.Call postReturnsValidateBeforeCall(StorePostReturnsR * @return StoreReturnsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreReturnsRes postReturns(StorePostReturnsReq body) throws ApiException { - ApiResponse resp = postReturnsWithHttpInfo(body); - return resp.getData(); - } - - /** - * Create Return - * Creates a Return for an Order. - * @param body (optional) - * @return ApiResponse<StoreReturnsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postReturnsWithHttpInfo(StorePostReturnsReq body) throws ApiException { - com.squareup.okhttp.Call call = postReturnsValidateBeforeCall(body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Create Return (asynchronously) - * Creates a Return for an Order. - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postReturnsAsync(StorePostReturnsReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postReturnsValidateBeforeCall(body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; + public CreateReturnRequest createReturn(StorePostReturnsReq body) throws ApiException { + return new CreateReturnRequest(medusaSdkClient); } } diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/returns/CreateReturnRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/returns/CreateReturnRequest.java new file mode 100644 index 0000000..d492937 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/returns/CreateReturnRequest.java @@ -0,0 +1,60 @@ +package mobi.appcent.medusa.store.model.request.returns; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StorePostReturnsReq; +import mobi.appcent.medusa.store.model.response.StoreReturnsRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 11.03.2023 + */ +public class CreateReturnRequest extends BaseRequest { + + private final MedusaSdkClient client; + private StorePostReturnsReq body; + + public CreateReturnRequest(MedusaSdkClient client) { + this.client = client; + } + + public CreateReturnRequest body(StorePostReturnsReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.RETURN_PATH; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} From f7d0413c97572fcd7c8fe581cf4b37de075bf2b2 Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Sat, 11 Mar 2023 14:59:25 +0300 Subject: [PATCH 17/32] feat(swap-api): Refactor swap api (#17) --- .../appcent/medusa/store/api/SwapApi.java | 246 +----------------- .../model/request/swap/CreateSwapRequest.java | 60 +++++ .../request/swap/GetSwapByCartIdRequest.java | 53 ++++ .../appcent/medusa/store/api/SwapApiTest.java | 4 +- 4 files changed, 122 insertions(+), 241 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/swap/CreateSwapRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/swap/GetSwapByCartIdRequest.java diff --git a/src/main/java/mobi/appcent/medusa/store/api/SwapApi.java b/src/main/java/mobi/appcent/medusa/store/api/SwapApi.java index 2a683bf..6f311ea 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/SwapApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/SwapApi.java @@ -15,20 +15,12 @@ import mobi.appcent.medusa.store.*; import mobi.appcent.medusa.store.MedusaSdkClient; -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - +import mobi.appcent.medusa.store.model.request.swap.CreateSwapRequest; +import mobi.appcent.medusa.store.model.request.swap.GetSwapByCartIdRequest; import mobi.appcent.medusa.store.model.response.StorePostSwapsReq; import mobi.appcent.medusa.store.model.response.StoreSwapsRes; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class SwapApi { private MedusaSdkClient medusaSdkClient; @@ -42,72 +34,6 @@ public MedusaSdkClient getApiClient() { public void setApiClient(MedusaSdkClient medusaSdkClient) { this.medusaSdkClient = medusaSdkClient; - } - - /** - * Build call for getSwapsSwapCartId - * @param cartId The id of the Cart (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getSwapsSwapCartIdCall(String cartId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/swaps/{cart_id}" - .replaceAll("\\{" + "cart_id" + "\\}", medusaSdkClient.escapeString(cartId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getSwapsSwapCartIdValidateBeforeCall(String cartId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'cartId' is set - if (cartId == null) { - throw new ApiException("Missing the required parameter 'cartId' when calling getSwapsSwapCartId(Async)"); - } - - com.squareup.okhttp.Call call = getSwapsSwapCartIdCall(cartId, progressListener, progressRequestListener); - return call; - - - - - } /** @@ -117,176 +43,18 @@ private com.squareup.okhttp.Call getSwapsSwapCartIdValidateBeforeCall(String car * @return StoreSwapsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreSwapsRes getSwapsSwapCartId(String cartId) throws ApiException { - ApiResponse resp = getSwapsSwapCartIdWithHttpInfo(cartId); - return resp.getData(); - } - - /** - * Get by Cart ID - * Retrieves a Swap by the id of the Cart used to confirm the Swap. - * @param cartId The id of the Cart (required) - * @return ApiResponse<StoreSwapsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getSwapsSwapCartIdWithHttpInfo(String cartId) throws ApiException { - com.squareup.okhttp.Call call = getSwapsSwapCartIdValidateBeforeCall(cartId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Get by Cart ID (asynchronously) - * Retrieves a Swap by the id of the Cart used to confirm the Swap. - * @param cartId The id of the Cart (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getSwapsSwapCartIdAsync(String cartId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getSwapsSwapCartIdValidateBeforeCall(cartId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postSwaps - * @param body (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postSwapsCall(StorePostSwapsReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/swaps"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postSwapsValidateBeforeCall(StorePostSwapsReq body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = postSwapsCall(body, progressListener, progressRequestListener); - return call; - - - - - + public GetSwapByCartIdRequest getSwapByCartId(String cartId) throws ApiException { + return new GetSwapByCartIdRequest(medusaSdkClient, cartId); } /** * Create a Swap * Creates a Swap on an Order by providing some items to return along with some items to send back - * @param body (optional) + * body (optional) * @return StoreSwapsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreSwapsRes postSwaps(StorePostSwapsReq body) throws ApiException { - ApiResponse resp = postSwapsWithHttpInfo(body); - return resp.getData(); - } - - /** - * Create a Swap - * Creates a Swap on an Order by providing some items to return along with some items to send back - * @param body (optional) - * @return ApiResponse<StoreSwapsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postSwapsWithHttpInfo(StorePostSwapsReq body) throws ApiException { - com.squareup.okhttp.Call call = postSwapsValidateBeforeCall(body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Create a Swap (asynchronously) - * Creates a Swap on an Order by providing some items to return along with some items to send back - * @param body (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postSwapsAsync(StorePostSwapsReq body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postSwapsValidateBeforeCall(body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; + public CreateSwapRequest createSwap() throws ApiException { + return new CreateSwapRequest(medusaSdkClient); } } diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/swap/CreateSwapRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/swap/CreateSwapRequest.java new file mode 100644 index 0000000..da37dae --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/swap/CreateSwapRequest.java @@ -0,0 +1,60 @@ +package mobi.appcent.medusa.store.model.request.swap; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StorePostSwapsReq; +import mobi.appcent.medusa.store.model.response.StoreSwapsRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 11.03.2023 + */ +public class CreateSwapRequest extends BaseRequest { + + private final MedusaSdkClient client; + private StorePostSwapsReq body; + + public CreateSwapRequest(MedusaSdkClient client) { + this.client = client; + } + + public CreateSwapRequest body(StorePostSwapsReq body) { + this.body = body; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.SWAP_PATH; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/swap/GetSwapByCartIdRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/swap/GetSwapByCartIdRequest.java new file mode 100644 index 0000000..4fe672e --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/swap/GetSwapByCartIdRequest.java @@ -0,0 +1,53 @@ +package mobi.appcent.medusa.store.model.request.swap; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreSwapsRes; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by erenalpaslan on 11.03.2023 + */ +public class GetSwapByCartIdRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String cartId; + + public GetSwapByCartIdRequest(MedusaSdkClient client, String cartId) { + this.client = client; + this.cartId = cartId; + } + + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.SWAP_PATH + "/" + cartId; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/test/java/mobi/appcent/medusa/store/api/SwapApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/SwapApiTest.java index 5280390..919dbad 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/SwapApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/SwapApiTest.java @@ -37,7 +37,7 @@ public class SwapApiTest { @Test public void getSwapsSwapCartIdTest() throws Exception { String cartId = null; - StoreSwapsRes response = api.getSwapsSwapCartId(cartId); + StoreSwapsRes response = api.getSwapByCartId(cartId).execute().getData(); // TODO: test validations } @@ -52,7 +52,7 @@ public void getSwapsSwapCartIdTest() throws Exception { @Test public void postSwapsTest() throws Exception { StorePostSwapsReq body = null; - StoreSwapsRes response = api.postSwaps(body); + StoreSwapsRes response = api.createSwap().execute().getData(); // TODO: test validations } From 4d7f00d2411fecbbadaeb41948e5d63afdb04f4b Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Sat, 11 Mar 2023 15:00:46 +0300 Subject: [PATCH 18/32] feat(product-type-api): Refactor product type api (#18) --- .../medusa/store/api/ProductTypeApi.java | 175 ++---------------- .../producttype/ListProductTypesRequest.java | 132 +++++++++++++ .../medusa/store/api/ProductTypeApiTest.java | 2 +- 3 files changed, 145 insertions(+), 164 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/producttype/ListProductTypesRequest.java diff --git a/src/main/java/mobi/appcent/medusa/store/api/ProductTypeApi.java b/src/main/java/mobi/appcent/medusa/store/api/ProductTypeApi.java index bd7e9f2..e50f1fc 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ProductTypeApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ProductTypeApi.java @@ -19,6 +19,7 @@ import java.io.IOException; +import mobi.appcent.medusa.store.model.request.producttype.ListProductTypesRequest; import mobi.appcent.medusa.store.model.response.CreatedAt3; import mobi.appcent.medusa.store.model.response.StoreProductTypesListRes; import mobi.appcent.medusa.store.model.response.UpdatedAt3; @@ -42,176 +43,24 @@ public MedusaSdkClient getApiClient() { public void setApiClient(MedusaSdkClient medusaSdkClient) { this.medusaSdkClient = medusaSdkClient; - } - - /** - * Build call for getProductTypes - * @param limit The number of types to return. (optional, default to 20) - * @param offset The number of items to skip before the results. (optional, default to 0) - * @param order The field to sort items by. (optional) - * @param discountConditionId The discount condition id on which to filter the product types. (optional) - * @param value The type values to search for (optional) - * @param id The type IDs to search for (optional) - * @param q A query string to search values for (optional) - * @param createdAt Date comparison for when resulting product types were created. (optional) - * @param updatedAt Date comparison for when resulting product types were updated. (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getProductTypesCall(Integer limit, Integer offset, String order, String discountConditionId, List value, List id, String q, CreatedAt3 createdAt, UpdatedAt3 updatedAt, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/product-types"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - if (limit != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("limit", limit)); - if (offset != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("offset", offset)); - if (order != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("order", order)); - if (discountConditionId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("discount_condition_id", discountConditionId)); - if (value != null) - localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "value", value)); - if (id != null) - localVarCollectionQueryParams.addAll(medusaSdkClient.parameterToPairs("csv", "id", id)); - if (q != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("q", q)); - if (createdAt != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("created_at", createdAt)); - if (updatedAt != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("updated_at", updatedAt)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "text/plain" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getProductTypesValidateBeforeCall(Integer limit, Integer offset, String order, String discountConditionId, List value, List id, String q, CreatedAt3 createdAt, UpdatedAt3 updatedAt, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = getProductTypesCall(limit, offset, order, discountConditionId, value, id, q, createdAt, updatedAt, progressListener, progressRequestListener); - return call; - - - - - } /** * List Product Types * Retrieve a list of Product Types. - * @param limit The number of types to return. (optional, default to 20) - * @param offset The number of items to skip before the results. (optional, default to 0) - * @param order The field to sort items by. (optional) - * @param discountConditionId The discount condition id on which to filter the product types. (optional) - * @param value The type values to search for (optional) - * @param id The type IDs to search for (optional) - * @param q A query string to search values for (optional) - * @param createdAt Date comparison for when resulting product types were created. (optional) - * @param updatedAt Date comparison for when resulting product types were updated. (optional) + * limit The number of types to return. (optional, default to 20) + * offset The number of items to skip before the results. (optional, default to 0) + * order The field to sort items by. (optional) + * discountConditionId The discount condition id on which to filter the product types. (optional) + * value The type values to search for (optional) + * id The type IDs to search for (optional) + * q A query string to search values for (optional) + * createdAt Date comparison for when resulting product types were created. (optional) + * updatedAt Date comparison for when resulting product types were updated. (optional) * @return StoreProductTypesListRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreProductTypesListRes getProductTypes(Integer limit, Integer offset, String order, String discountConditionId, List value, List id, String q, CreatedAt3 createdAt, UpdatedAt3 updatedAt) throws ApiException { - ApiResponse resp = getProductTypesWithHttpInfo(limit, offset, order, discountConditionId, value, id, q, createdAt, updatedAt); - return resp.getData(); - } - - /** - * List Product Types - * Retrieve a list of Product Types. - * @param limit The number of types to return. (optional, default to 20) - * @param offset The number of items to skip before the results. (optional, default to 0) - * @param order The field to sort items by. (optional) - * @param discountConditionId The discount condition id on which to filter the product types. (optional) - * @param value The type values to search for (optional) - * @param id The type IDs to search for (optional) - * @param q A query string to search values for (optional) - * @param createdAt Date comparison for when resulting product types were created. (optional) - * @param updatedAt Date comparison for when resulting product types were updated. (optional) - * @return ApiResponse<StoreProductTypesListRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getProductTypesWithHttpInfo(Integer limit, Integer offset, String order, String discountConditionId, List value, List id, String q, CreatedAt3 createdAt, UpdatedAt3 updatedAt) throws ApiException { - com.squareup.okhttp.Call call = getProductTypesValidateBeforeCall(limit, offset, order, discountConditionId, value, id, q, createdAt, updatedAt, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * List Product Types (asynchronously) - * Retrieve a list of Product Types. - * @param limit The number of types to return. (optional, default to 20) - * @param offset The number of items to skip before the results. (optional, default to 0) - * @param order The field to sort items by. (optional) - * @param discountConditionId The discount condition id on which to filter the product types. (optional) - * @param value The type values to search for (optional) - * @param id The type IDs to search for (optional) - * @param q A query string to search values for (optional) - * @param createdAt Date comparison for when resulting product types were created. (optional) - * @param updatedAt Date comparison for when resulting product types were updated. (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getProductTypesAsync(Integer limit, Integer offset, String order, String discountConditionId, List value, List id, String q, CreatedAt3 createdAt, UpdatedAt3 updatedAt, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getProductTypesValidateBeforeCall(limit, offset, order, discountConditionId, value, id, q, createdAt, updatedAt, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; + public ListProductTypesRequest getProductTypes() throws ApiException { + return new ListProductTypesRequest(medusaSdkClient); } } diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/producttype/ListProductTypesRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/producttype/ListProductTypesRequest.java new file mode 100644 index 0000000..9941c29 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/producttype/ListProductTypesRequest.java @@ -0,0 +1,132 @@ +package mobi.appcent.medusa.store.model.request.producttype; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.QueryParamConstant; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.CreatedAt3; +import mobi.appcent.medusa.store.model.response.StoreProductTypesListRes; +import mobi.appcent.medusa.store.model.response.UpdatedAt3; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 10.03.2023 + */ +public class ListProductTypesRequest extends BaseRequest { + + private final MedusaSdkClient client; + private Integer limit; + private Integer offset; + private String order; + private String discountConditionId; + private List value; + private List id; + private String q; + private CreatedAt3 createdAt; + private UpdatedAt3 updatedAt; + + public ListProductTypesRequest(MedusaSdkClient client) { + this.client = client; + } + + public ListProductTypesRequest limit(Integer limit) { + this.limit = limit; + return this; + } + + public ListProductTypesRequest offset(Integer offset) { + this.offset = offset; + return this; + } + + public ListProductTypesRequest discountConditionId(String discountConditionId) { + this.discountConditionId = discountConditionId; + return this; + } + + public ListProductTypesRequest order(String order) { + this.order = order; + return this; + } + + public ListProductTypesRequest value(List value) { + this.value = value; + return this; + } + + public ListProductTypesRequest id(List id) { + this.id = id; + return this; + } + + public ListProductTypesRequest q(String q) { + this.q = q; + return this; + } + + public ListProductTypesRequest createdAt(CreatedAt3 createdAt) { + this.createdAt = createdAt; + return this; + } + + public ListProductTypesRequest updatedAt(UpdatedAt3 updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.PRODUCT_TYPE_PATH; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON, HeaderConstant.TEXT_PLAIN }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (limit != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.LIMIT, limit)); + if (offset != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.OFFSET, offset)); + if (order != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.ORDER, order)); + if (discountConditionId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.DISCOUNT_CONDITION_ID, discountConditionId)); + if (value != null) + localVarCollectionQueryParams.addAll(client.parameterToPairs(QueryParamConstant.CSV_FORMAT, QueryParamConstant.VALUE, value)); + if (id != null) + localVarCollectionQueryParams.addAll(client.parameterToPairs(QueryParamConstant.CSV_FORMAT, QueryParamConstant.ID, id)); + if (q != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.Q, q)); + if (createdAt != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CREATED_AT, createdAt)); + if (updatedAt != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.UPDATED_AT, updatedAt)); + + String[] localVarAuthNames = new String[] { "cookie_auth" }; + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, localVarCollectionQueryParams, null, headers, null, localVarAuthNames); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/test/java/mobi/appcent/medusa/store/api/ProductTypeApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/ProductTypeApiTest.java index e442ac5..9e036f9 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/ProductTypeApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/ProductTypeApiTest.java @@ -49,7 +49,7 @@ public void getProductTypesTest() throws Exception { String q = null; CreatedAt3 createdAt = null; UpdatedAt3 updatedAt = null; - StoreProductTypesListRes response = api.getProductTypes(limit, offset, order, discountConditionId, value, id, q, createdAt, updatedAt); + StoreProductTypesListRes response = api.getProductTypes().execute().getData(); // TODO: test validations } From c9fc9b12ba6ae38d1eb3e767dcf7b45b4e4862bf Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Sat, 11 Mar 2023 15:01:32 +0300 Subject: [PATCH 19/32] feat(product-variant-api): Refactor product variant api (#19) --- .../medusa/store/api/ProductVariantApi.java | 329 ++---------------- .../store/common/QueryParamConstant.java | 2 + .../GetProductVariantRequest.java | 91 +++++ .../GetProductVariantsRequest.java | 140 ++++++++ .../store/api/ProductVariantApiTest.java | 2 +- 5 files changed, 254 insertions(+), 310 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/productvariant/GetProductVariantRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/productvariant/GetProductVariantsRequest.java diff --git a/src/main/java/mobi/appcent/medusa/store/api/ProductVariantApi.java b/src/main/java/mobi/appcent/medusa/store/api/ProductVariantApi.java index 835ec07..84fb643 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ProductVariantApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ProductVariantApi.java @@ -21,6 +21,8 @@ import java.math.BigDecimal; +import mobi.appcent.medusa.store.model.request.productvariant.GetProductVariantRequest; +import mobi.appcent.medusa.store.model.request.productvariant.GetProductVariantsRequest; import mobi.appcent.medusa.store.model.response.InventoryQuantity; import mobi.appcent.medusa.store.model.response.StoreVariantsListRes; import mobi.appcent.medusa.store.model.response.StoreVariantsRes; @@ -45,331 +47,40 @@ public MedusaSdkClient getApiClient() { public void setApiClient(MedusaSdkClient medusaSdkClient) { this.medusaSdkClient = medusaSdkClient; - } - - /** - * Build call for getVariants - * @param ids A comma separated list of Product Variant ids to filter by. (optional) - * @param salesChannelId A sales channel id for result configuration. (optional) - * @param expand A comma separated list of Product Variant relations to load. (optional) - * @param offset How many product variants to skip in the result. (optional) - * @param limit Maximum number of Product Variants to return. (optional) - * @param cartId The id of the Cart to set prices based on. (optional) - * @param regionId The id of the Region to set prices based on. (optional) - * @param currencyCode The currency code to use for price selection. (optional) - * @param title product variant title to search for. (optional) - * @param inventoryQuantity Filter by available inventory quantity (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getVariantsCall(String ids, String salesChannelId, String expand, BigDecimal offset, BigDecimal limit, String cartId, String regionId, String currencyCode, Title title, InventoryQuantity inventoryQuantity, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/variants"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - if (ids != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("ids", ids)); - if (salesChannelId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("sales_channel_id", salesChannelId)); - if (expand != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("expand", expand)); - if (offset != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("offset", offset)); - if (limit != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("limit", limit)); - if (cartId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("cart_id", cartId)); - if (regionId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("region_id", regionId)); - if (currencyCode != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("currency_code", currencyCode)); - if (title != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("title", title)); - if (inventoryQuantity != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("inventory_quantity", inventoryQuantity)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getVariantsValidateBeforeCall(String ids, String salesChannelId, String expand, BigDecimal offset, BigDecimal limit, String cartId, String regionId, String currencyCode, Title title, InventoryQuantity inventoryQuantity, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = getVariantsCall(ids, salesChannelId, expand, offset, limit, cartId, regionId, currencyCode, title, inventoryQuantity, progressListener, progressRequestListener); - return call; - - - - - } /** * Get Product Variants * Retrieves a list of Product Variants - * @param ids A comma separated list of Product Variant ids to filter by. (optional) - * @param salesChannelId A sales channel id for result configuration. (optional) - * @param expand A comma separated list of Product Variant relations to load. (optional) - * @param offset How many product variants to skip in the result. (optional) - * @param limit Maximum number of Product Variants to return. (optional) - * @param cartId The id of the Cart to set prices based on. (optional) - * @param regionId The id of the Region to set prices based on. (optional) - * @param currencyCode The currency code to use for price selection. (optional) - * @param title product variant title to search for. (optional) - * @param inventoryQuantity Filter by available inventory quantity (optional) + * ids A comma separated list of Product Variant ids to filter by. (optional) + * salesChannelId A sales channel id for result configuration. (optional) + * expand A comma separated list of Product Variant relations to load. (optional) + * offset How many product variants to skip in the result. (optional) + * limit Maximum number of Product Variants to return. (optional) + * cartId The id of the Cart to set prices based on. (optional) + * regionId The id of the Region to set prices based on. (optional) + * currencyCode The currency code to use for price selection. (optional) + * title product variant title to search for. (optional) + * inventoryQuantity Filter by available inventory quantity (optional) * @return StoreVariantsListRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreVariantsListRes getVariants(String ids, String salesChannelId, String expand, BigDecimal offset, BigDecimal limit, String cartId, String regionId, String currencyCode, Title title, InventoryQuantity inventoryQuantity) throws ApiException { - ApiResponse resp = getVariantsWithHttpInfo(ids, salesChannelId, expand, offset, limit, cartId, regionId, currencyCode, title, inventoryQuantity); - return resp.getData(); - } - - /** - * Get Product Variants - * Retrieves a list of Product Variants - * @param ids A comma separated list of Product Variant ids to filter by. (optional) - * @param salesChannelId A sales channel id for result configuration. (optional) - * @param expand A comma separated list of Product Variant relations to load. (optional) - * @param offset How many product variants to skip in the result. (optional) - * @param limit Maximum number of Product Variants to return. (optional) - * @param cartId The id of the Cart to set prices based on. (optional) - * @param regionId The id of the Region to set prices based on. (optional) - * @param currencyCode The currency code to use for price selection. (optional) - * @param title product variant title to search for. (optional) - * @param inventoryQuantity Filter by available inventory quantity (optional) - * @return ApiResponse<StoreVariantsListRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getVariantsWithHttpInfo(String ids, String salesChannelId, String expand, BigDecimal offset, BigDecimal limit, String cartId, String regionId, String currencyCode, Title title, InventoryQuantity inventoryQuantity) throws ApiException { - com.squareup.okhttp.Call call = getVariantsValidateBeforeCall(ids, salesChannelId, expand, offset, limit, cartId, regionId, currencyCode, title, inventoryQuantity, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Get Product Variants (asynchronously) - * Retrieves a list of Product Variants - * @param ids A comma separated list of Product Variant ids to filter by. (optional) - * @param salesChannelId A sales channel id for result configuration. (optional) - * @param expand A comma separated list of Product Variant relations to load. (optional) - * @param offset How many product variants to skip in the result. (optional) - * @param limit Maximum number of Product Variants to return. (optional) - * @param cartId The id of the Cart to set prices based on. (optional) - * @param regionId The id of the Region to set prices based on. (optional) - * @param currencyCode The currency code to use for price selection. (optional) - * @param title product variant title to search for. (optional) - * @param inventoryQuantity Filter by available inventory quantity (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getVariantsAsync(String ids, String salesChannelId, String expand, BigDecimal offset, BigDecimal limit, String cartId, String regionId, String currencyCode, Title title, InventoryQuantity inventoryQuantity, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getVariantsValidateBeforeCall(ids, salesChannelId, expand, offset, limit, cartId, regionId, currencyCode, title, inventoryQuantity, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getVariantsVariant - * @param variantId The id of the Product Variant. (required) - * @param cartId The id of the Cart to set prices based on. (optional) - * @param salesChannelId A sales channel id for result configuration. (optional) - * @param regionId The id of the Region to set prices based on. (optional) - * @param currencyCode The 3 character ISO currency code to set prices based on. (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getVariantsVariantCall(String variantId, String cartId, String salesChannelId, String regionId, String currencyCode, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/variants/{variant_id}" - .replaceAll("\\{" + "variant_id" + "\\}", medusaSdkClient.escapeString(variantId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - if (cartId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("cart_id", cartId)); - if (salesChannelId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("sales_channel_id", salesChannelId)); - if (regionId != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("region_id", regionId)); - if (currencyCode != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("currency_code", currencyCode)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getVariantsVariantValidateBeforeCall(String variantId, String cartId, String salesChannelId, String regionId, String currencyCode, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'variantId' is set - if (variantId == null) { - throw new ApiException("Missing the required parameter 'variantId' when calling getVariantsVariant(Async)"); - } - - com.squareup.okhttp.Call call = getVariantsVariantCall(variantId, cartId, salesChannelId, regionId, currencyCode, progressListener, progressRequestListener); - return call; - - - - - + public GetProductVariantsRequest getVariants() throws ApiException { + return new GetProductVariantsRequest(medusaSdkClient); } /** * Get a Product Variant * Retrieves a Product Variant by id * @param variantId The id of the Product Variant. (required) - * @param cartId The id of the Cart to set prices based on. (optional) - * @param salesChannelId A sales channel id for result configuration. (optional) - * @param regionId The id of the Region to set prices based on. (optional) - * @param currencyCode The 3 character ISO currency code to set prices based on. (optional) + * cartId The id of the Cart to set prices based on. (optional) + * salesChannelId A sales channel id for result configuration. (optional) + * regionId The id of the Region to set prices based on. (optional) + * currencyCode The 3 character ISO currency code to set prices based on. (optional) * @return StoreVariantsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreVariantsRes getVariantsVariant(String variantId, String cartId, String salesChannelId, String regionId, String currencyCode) throws ApiException { - ApiResponse resp = getVariantsVariantWithHttpInfo(variantId, cartId, salesChannelId, regionId, currencyCode); - return resp.getData(); - } - - /** - * Get a Product Variant - * Retrieves a Product Variant by id - * @param variantId The id of the Product Variant. (required) - * @param cartId The id of the Cart to set prices based on. (optional) - * @param salesChannelId A sales channel id for result configuration. (optional) - * @param regionId The id of the Region to set prices based on. (optional) - * @param currencyCode The 3 character ISO currency code to set prices based on. (optional) - * @return ApiResponse<StoreVariantsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getVariantsVariantWithHttpInfo(String variantId, String cartId, String salesChannelId, String regionId, String currencyCode) throws ApiException { - com.squareup.okhttp.Call call = getVariantsVariantValidateBeforeCall(variantId, cartId, salesChannelId, regionId, currencyCode, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Get a Product Variant (asynchronously) - * Retrieves a Product Variant by id - * @param variantId The id of the Product Variant. (required) - * @param cartId The id of the Cart to set prices based on. (optional) - * @param salesChannelId A sales channel id for result configuration. (optional) - * @param regionId The id of the Region to set prices based on. (optional) - * @param currencyCode The 3 character ISO currency code to set prices based on. (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getVariantsVariantAsync(String variantId, String cartId, String salesChannelId, String regionId, String currencyCode, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getVariantsVariantValidateBeforeCall(variantId, cartId, salesChannelId, regionId, currencyCode, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; + public GetProductVariantRequest getVariant(String variantId) throws ApiException { + return new GetProductVariantRequest(medusaSdkClient, variantId); } } diff --git a/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java b/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java index 22a7091..774250c 100644 --- a/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java +++ b/src/main/java/mobi/appcent/medusa/store/common/QueryParamConstant.java @@ -38,6 +38,8 @@ public class QueryParamConstant { public static final String DISCOUNT_CONDITION_ID = "discount_condition_id"; public static final String VALUE = "value"; public static final String PARENT_CATEGORY_ID = "parent_category_id"; + public static final String IDS = "ids"; + public static final String INVENTORY_QUANTITY = "inventory_quantity"; public static final String IS_RETURN = "is_return"; public static final String PRODUCT_IDS = "product_ids"; diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/productvariant/GetProductVariantRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/productvariant/GetProductVariantRequest.java new file mode 100644 index 0000000..e9f65ca --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/productvariant/GetProductVariantRequest.java @@ -0,0 +1,91 @@ +package mobi.appcent.medusa.store.model.request.productvariant; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.QueryParamConstant; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreVariantsRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 11.03.2023 + */ +public class GetProductVariantRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String variantId; + private String cartId; + private String salesChannelId; + private String regionId; + private String currencyCode; + + public GetProductVariantRequest(MedusaSdkClient client, String variantId) { + this.client = client; + this.variantId = variantId; + } + + public GetProductVariantRequest cartId(String cartId) { + this.cartId = cartId; + return this; + } + + public GetProductVariantRequest salesChannelId(String salesChannelId) { + this.salesChannelId = salesChannelId; + return this; + } + + public GetProductVariantRequest regionId(String regionId) { + this.regionId = regionId; + return this; + } + + public GetProductVariantRequest currencyCode(String currencyCode) { + this.currencyCode = currencyCode; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.PRODUCT_VARIANTS_PATH + "/" + variantId; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + List localVarQueryParams = new ArrayList(); + if (cartId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CART_ID, cartId)); + if (salesChannelId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.SALES_CHANNEL_ID, salesChannelId)); + if (regionId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.REGION_ID, regionId)); + if (currencyCode != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CURRENCY_CODE, currencyCode)); + + + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/productvariant/GetProductVariantsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/productvariant/GetProductVariantsRequest.java new file mode 100644 index 0000000..b2dd4e5 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/productvariant/GetProductVariantsRequest.java @@ -0,0 +1,140 @@ +package mobi.appcent.medusa.store.model.request.productvariant; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.QueryParamConstant; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.InventoryQuantity; +import mobi.appcent.medusa.store.model.response.StoreVariantsListRes; +import mobi.appcent.medusa.store.model.response.Title; + +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 11.03.2023 + */ +public class GetProductVariantsRequest extends BaseRequest { + + private final MedusaSdkClient client; + private String ids; + private String salesChannelId; + private String expand; + private BigDecimal offset; + private BigDecimal limit; + private String cartId; + private String regionId; + private String currencyCode; + private Title title; + private InventoryQuantity inventoryQuantity; + + public GetProductVariantsRequest(MedusaSdkClient client) { + this.client = client; + } + + public GetProductVariantsRequest ids(String ids) { + this.ids = ids; + return this; + } + + public GetProductVariantsRequest salesChannelId(String salesChannelId) { + this.salesChannelId = salesChannelId; + return this; + } + + public GetProductVariantsRequest expand(String expand) { + this.expand = expand; + return this; + } + + public GetProductVariantsRequest offset(BigDecimal offset) { + this.offset = offset; + return this; + } + + public GetProductVariantsRequest limit(BigDecimal limit) { + this.limit = limit; + return this; + } + + public GetProductVariantsRequest cartId(String cartId) { + this.cartId = cartId; + return this; + } + + public GetProductVariantsRequest regionId(String regionId) { + this.regionId = regionId; + return this; + } + + public GetProductVariantsRequest currencyCode(String currencyCode) { + this.currencyCode = currencyCode; + return this; + } + + public GetProductVariantsRequest title(Title title) { + this.title = title; + return this; + } + + public GetProductVariantsRequest inventoryQuantity(InventoryQuantity inventoryQuantity) { + this.inventoryQuantity = inventoryQuantity; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.PRODUCT_VARIANTS_PATH; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + List localVarQueryParams = new ArrayList(); + if (ids != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.IDS, ids)); + if (salesChannelId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.SALES_CHANNEL_ID, salesChannelId)); + if (expand != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.EXPAND, expand)); + if (offset != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.OFFSET, offset)); + if (limit != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.LIMIT, limit)); + if (cartId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CART_ID, cartId)); + if (regionId != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.REGION_ID, regionId)); + if (currencyCode != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CURRENCY_CODE, currencyCode)); + if (title != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.TITLE, title)); + if (inventoryQuantity != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.INVENTORY_QUANTITY, inventoryQuantity)); + + + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/test/java/mobi/appcent/medusa/store/api/ProductVariantApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/ProductVariantApiTest.java index db5a7b5..a341157 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/ProductVariantApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/ProductVariantApiTest.java @@ -50,7 +50,7 @@ public void getVariantsTest() throws Exception { String currencyCode = null; Title title = null; InventoryQuantity inventoryQuantity = null; - StoreVariantsListRes response = api.getVariants(ids, salesChannelId, expand, offset, limit, cartId, regionId, currencyCode, title, inventoryQuantity); + StoreVariantsListRes response = api.getVariants().execute().getData(); // TODO: test validations } From 99aa2f61c404cff4a078fa6705eed71a54f68ef9 Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Sat, 11 Mar 2023 15:02:11 +0300 Subject: [PATCH 20/32] feat(region-api): Refactor region api (#20) --- .../appcent/medusa/store/api/RegionApi.java | 259 +----------------- .../request/region/GetRegionRequest.java | 56 ++++ .../request/region/ListRegionsRequest.java | 90 ++++++ .../medusa/store/api/RegionApiTest.java | 4 +- 4 files changed, 158 insertions(+), 251 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/region/GetRegionRequest.java create mode 100644 src/main/java/mobi/appcent/medusa/store/model/request/region/ListRegionsRequest.java diff --git a/src/main/java/mobi/appcent/medusa/store/api/RegionApi.java b/src/main/java/mobi/appcent/medusa/store/api/RegionApi.java index 533ce32..0508523 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/RegionApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/RegionApi.java @@ -19,6 +19,8 @@ import java.io.IOException; +import mobi.appcent.medusa.store.model.request.region.GetRegionRequest; +import mobi.appcent.medusa.store.model.request.region.ListRegionsRequest; import mobi.appcent.medusa.store.model.response.CreatedAt5; import mobi.appcent.medusa.store.model.response.StoreRegionsListRes; import mobi.appcent.medusa.store.model.response.StoreRegionsRes; @@ -43,212 +45,20 @@ public MedusaSdkClient getApiClient() { public void setApiClient(MedusaSdkClient medusaSdkClient) { this.medusaSdkClient = medusaSdkClient; - } - - /** - * Build call for getRegions - * @param offset How many regions to skip in the result. (optional, default to 0) - * @param limit Limit the number of regions returned. (optional, default to 100) - * @param createdAt Date comparison for when resulting regions were created. (optional) - * @param updatedAt Date comparison for when resulting regions were updated. (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getRegionsCall(Integer offset, Integer limit, CreatedAt5 createdAt, UpdatedAt5 updatedAt, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/regions"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - if (offset != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("offset", offset)); - if (limit != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("limit", limit)); - if (createdAt != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("created_at", createdAt)); - if (updatedAt != null) - localVarQueryParams.addAll(medusaSdkClient.parameterToPair("updated_at", updatedAt)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getRegionsValidateBeforeCall(Integer offset, Integer limit, CreatedAt5 createdAt, UpdatedAt5 updatedAt, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - com.squareup.okhttp.Call call = getRegionsCall(offset, limit, createdAt, updatedAt, progressListener, progressRequestListener); - return call; - - - - - } /** * List Regions * Retrieves a list of Regions. - * @param offset How many regions to skip in the result. (optional, default to 0) - * @param limit Limit the number of regions returned. (optional, default to 100) - * @param createdAt Date comparison for when resulting regions were created. (optional) - * @param updatedAt Date comparison for when resulting regions were updated. (optional) + * offset How many regions to skip in the result. (optional, default to 0) + * limit Limit the number of regions returned. (optional, default to 100) + * createdAt Date comparison for when resulting regions were created. (optional) + * updatedAt Date comparison for when resulting regions were updated. (optional) * @return StoreRegionsListRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreRegionsListRes getRegions(Integer offset, Integer limit, CreatedAt5 createdAt, UpdatedAt5 updatedAt) throws ApiException { - ApiResponse resp = getRegionsWithHttpInfo(offset, limit, createdAt, updatedAt); - return resp.getData(); - } - - /** - * List Regions - * Retrieves a list of Regions. - * @param offset How many regions to skip in the result. (optional, default to 0) - * @param limit Limit the number of regions returned. (optional, default to 100) - * @param createdAt Date comparison for when resulting regions were created. (optional) - * @param updatedAt Date comparison for when resulting regions were updated. (optional) - * @return ApiResponse<StoreRegionsListRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getRegionsWithHttpInfo(Integer offset, Integer limit, CreatedAt5 createdAt, UpdatedAt5 updatedAt) throws ApiException { - com.squareup.okhttp.Call call = getRegionsValidateBeforeCall(offset, limit, createdAt, updatedAt, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * List Regions (asynchronously) - * Retrieves a list of Regions. - * @param offset How many regions to skip in the result. (optional, default to 0) - * @param limit Limit the number of regions returned. (optional, default to 100) - * @param createdAt Date comparison for when resulting regions were created. (optional) - * @param updatedAt Date comparison for when resulting regions were updated. (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getRegionsAsync(Integer offset, Integer limit, CreatedAt5 createdAt, UpdatedAt5 updatedAt, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getRegionsValidateBeforeCall(offset, limit, createdAt, updatedAt, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getRegionsRegion - * @param id The id of the Region. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getRegionsRegionCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/regions/{id}" - .replaceAll("\\{" + "id" + "\\}", medusaSdkClient.escapeString(id.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = medusaSdkClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = medusaSdkClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - medusaSdkClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return medusaSdkClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getRegionsRegionValidateBeforeCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - // verify the required parameter 'id' is set - if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling getRegionsRegion(Async)"); - } - - com.squareup.okhttp.Call call = getRegionsRegionCall(id, progressListener, progressRequestListener); - return call; - - - - - + public ListRegionsRequest getRegions() throws ApiException { + return new ListRegionsRequest(medusaSdkClient); } /** @@ -258,56 +68,7 @@ private com.squareup.okhttp.Call getRegionsRegionValidateBeforeCall(String id, f * @return StoreRegionsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public StoreRegionsRes getRegionsRegion(String id) throws ApiException { - ApiResponse resp = getRegionsRegionWithHttpInfo(id); - return resp.getData(); - } - - /** - * Get a Region - * Retrieves a Region. - * @param id The id of the Region. (required) - * @return ApiResponse<StoreRegionsRes> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getRegionsRegionWithHttpInfo(String id) throws ApiException { - com.squareup.okhttp.Call call = getRegionsRegionValidateBeforeCall(id, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return medusaSdkClient.execute(call, localVarReturnType); - } - - /** - * Get a Region (asynchronously) - * Retrieves a Region. - * @param id The id of the Region. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getRegionsRegionAsync(String id, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getRegionsRegionValidateBeforeCall(id, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - medusaSdkClient.executeAsync(call, localVarReturnType, callback); - return call; + public GetRegionRequest getRegion(String id) throws ApiException { + return new GetRegionRequest(medusaSdkClient, id); } } diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/region/GetRegionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/region/GetRegionRequest.java new file mode 100644 index 0000000..aeb2f33 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/region/GetRegionRequest.java @@ -0,0 +1,56 @@ +package mobi.appcent.medusa.store.model.request.region; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.QueryParamConstant; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.StoreRegionsRes; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 11.03.2023 + */ +public class GetRegionRequest extends BaseRequest { + + private final MedusaSdkClient client; + private final String id; + + public GetRegionRequest(MedusaSdkClient client, String id) { + this.client = client; + this.id = id; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.REGION_PATH + "/" + id; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/region/ListRegionsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/region/ListRegionsRequest.java new file mode 100644 index 0000000..7ec024e --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/model/request/region/ListRegionsRequest.java @@ -0,0 +1,90 @@ +package mobi.appcent.medusa.store.model.request.region; + +import com.squareup.okhttp.Call; +import mobi.appcent.medusa.store.*; +import mobi.appcent.medusa.store.common.HeaderConstant; +import mobi.appcent.medusa.store.common.HttpMethod; +import mobi.appcent.medusa.store.common.QueryParamConstant; +import mobi.appcent.medusa.store.common.UrlConstant; +import mobi.appcent.medusa.store.model.request.BaseRequest; +import mobi.appcent.medusa.store.model.response.CreatedAt5; +import mobi.appcent.medusa.store.model.response.StoreRegionsListRes; +import mobi.appcent.medusa.store.model.response.UpdatedAt5; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by erenalpaslan on 11.03.2023 + */ +public class ListRegionsRequest extends BaseRequest { + + private final MedusaSdkClient client; + private Integer offset; + private Integer limit; + private CreatedAt5 createdAt; + private UpdatedAt5 updatedAt; + + public ListRegionsRequest(MedusaSdkClient client) { + this.client = client; + } + + public ListRegionsRequest offset(Integer offset) { + this.offset = offset; + return this; + } + + public ListRegionsRequest limit(Integer limit) { + this.limit = limit; + return this; + } + + public ListRegionsRequest createdAt(CreatedAt5 createdAt) { + this.createdAt = createdAt; + return this; + } + + public ListRegionsRequest updatedAt(UpdatedAt5 updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + @Override + protected Call buildCall() throws ApiException { + String path = UrlConstant.REGION_PATH; + Map headers = new HashMap<>(); + + final String[] localVarAccepts = { HeaderConstant.APPLICATION_JSON }; + final String localVarAccept = client.selectHeaderAccept(localVarAccepts); + + if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); + headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); + + List localVarQueryParams = new ArrayList(); + if (offset != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.OFFSET, offset)); + if (limit != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.LIMIT, limit)); + if (createdAt != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CREATED_AT, createdAt)); + if (updatedAt != null) + localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.UPDATED_AT, updatedAt)); + + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, null); + } + + @Override + public ApiResponse execute() throws ApiException { + Call call = buildCall(); + return client.execute(call); + } + + @Override + public void executeAsync(ApiCallback callback) throws ApiException { + Call call = buildCall(); + client.executeAsync(call, callback); + } +} diff --git a/src/test/java/mobi/appcent/medusa/store/api/RegionApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/RegionApiTest.java index 1f2c5f2..9c051bf 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/RegionApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/RegionApiTest.java @@ -42,7 +42,7 @@ public void getRegionsTest() throws Exception { Integer limit = null; CreatedAt5 createdAt = null; UpdatedAt5 updatedAt = null; - StoreRegionsListRes response = api.getRegions(offset, limit, createdAt, updatedAt); + StoreRegionsListRes response = api.getRegions().execute().getData(); // TODO: test validations } @@ -57,7 +57,7 @@ public void getRegionsTest() throws Exception { @Test public void getRegionsRegionTest() throws Exception { String id = null; - StoreRegionsRes response = api.getRegionsRegion(id); + StoreRegionsRes response = api.getRegion(id).execute().getData(); // TODO: test validations } From bcf3243cfadec0f705d59a76422a3f0603af9179 Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Sat, 11 Mar 2023 15:09:40 +0300 Subject: [PATCH 21/32] feat(invite-api): Refactor invite api (#21) --- src/test/java/mobi/appcent/medusa/store/api/InviteApiTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/mobi/appcent/medusa/store/api/InviteApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/InviteApiTest.java index dd9e2a6..4cb5a34 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/InviteApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/InviteApiTest.java @@ -36,7 +36,7 @@ public class InviteApiTest { @Test public void postOrdersCustomerOrderClaimTest() throws Exception { StorePostCustomersCustomerOrderClaimReq body = null; - api.postOrdersCustomerOrderClaim(body); + api.claimOrder().execute(); // TODO: test validations } From 40209577a3160b5f429bd352b27eacf249fb834a Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Sat, 11 Mar 2023 15:22:27 +0300 Subject: [PATCH 22/32] feat(pipeline): Implement github actions flow and update pom (#22) --- .github/workflows/maven-publish.yml | 29 ++++++++++++++++ build.gradle | 6 ++-- jitpack.yml | 2 ++ pom.xml | 34 ++++++++++++------- .../java/mobi/appcent/medusa/store/Main.java | 30 ---------------- 5 files changed, 56 insertions(+), 45 deletions(-) create mode 100644 .github/workflows/maven-publish.yml create mode 100644 jitpack.yml delete mode 100644 src/main/java/mobi/appcent/medusa/store/Main.java diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml new file mode 100644 index 0000000..6423e71 --- /dev/null +++ b/.github/workflows/maven-publish.yml @@ -0,0 +1,29 @@ +name: Publish package to GitHub Packages +on: + push: + branches: + - 'release/**' +jobs: + publish: + runs-on: ubuntu-latest + permissions: write-all + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'adopt' + - name: Publish package + run: mvn --batch-mode deploy + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release ✅ + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref_name }} + release_name: ${{ github.ref_name }} + draft: false + prerelease: false \ No newline at end of file diff --git a/build.gradle b/build.gradle index 3cad924..d9a4610 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'idea' apply plugin: 'eclipse' -group = 'io.swagger' +group = 'mobi.appcent' version = '1.0.0' buildscript { @@ -25,11 +25,11 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'com.github.dcendents.android-maven' android { - compileSdkVersion 25 + compileSdkVersion 32 buildToolsVersion '25.0.2' defaultConfig { minSdkVersion 14 - targetSdkVersion 25 + targetSdkVersion 32 } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000..169b98a --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,2 @@ +jdk: + - openjdk8 \ No newline at end of file diff --git a/pom.xml b/pom.xml index 3bf3859..aa9ca59 100644 --- a/pom.xml +++ b/pom.xml @@ -1,27 +1,37 @@ 4.0.0 + mobi.appcent medusa-java-sdk 1.0.0 medusa-java-sdk - - scm:git:git@github.com:swagger-api/swagger-codegen.git - scm:git:git@github.com:swagger-api/swagger-codegen.git - https://github.com/swagger-api/swagger-codegen - 2.2.0 - - - Unlicense - https://github.com/medusajs/medusa/blob/master/LICENSE - repo - - + + + github + GitHub Packages + https://maven.pkg.github.com/AppcentMobile/medusa-java-sdk + + true + + + true + + + + + + + github + GitHub Packages + https://maven.pkg.github.com/AppcentMobile/medusa-java-sdk + + diff --git a/src/main/java/mobi/appcent/medusa/store/Main.java b/src/main/java/mobi/appcent/medusa/store/Main.java deleted file mode 100644 index a748333..0000000 --- a/src/main/java/mobi/appcent/medusa/store/Main.java +++ /dev/null @@ -1,30 +0,0 @@ -package mobi.appcent.medusa.store; - -import mobi.appcent.medusa.store.model.response.StoreAuthRes; -import mobi.appcent.medusa.store.model.response.StorePostAuthReq; - -/** - * Created by erenalpaslan on 25.02.2023 - */ -public class Main { - public static void main(String[] args) { - MedusaApi medusaApi = new MedusaApi(); - - medusaApi.getDefaultApiClient() - .setDebugging(true) - .setVerifyingSsl(false) - .setBasePath("http://localhost:9000/store"); - - try { - ApiResponse res = medusaApi - .auth() - .postAuth() - .email("test@gmail.com") - .password("supersecret") - .execute(); - System.out.println(res.getData()); - } catch (ApiException exception) { - System.err.println(exception); - } - } -} From cc2f2eaf62b95524fc9e00d4d488eeb292faee7e Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Sat, 11 Mar 2023 15:32:33 +0300 Subject: [PATCH 23/32] Feature/pipeline (#23) * feat(pipeline): Implement github actions flow and update pom * fix!(pipeline): Remove prerequisites from pom --- pom.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pom.xml b/pom.xml index aa9ca59..5ab12ac 100644 --- a/pom.xml +++ b/pom.xml @@ -7,10 +7,6 @@ 1.0.0 medusa-java-sdk - - 2.2.0 - - github From cd51ab9789f2115156c8c4cb94b3130d02e88eae Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Sat, 11 Mar 2023 15:37:43 +0300 Subject: [PATCH 24/32] Feature/pipeline (#24) * feat(pipeline): Implement github actions flow and update pom * fix!(pipeline): Remove prerequisites from pom * fix!: Test issues --- src/main/java/mobi/appcent/medusa/store/api/ReturnApi.java | 2 +- .../mobi/appcent/medusa/store/api/ProductVariantApiTest.java | 2 +- src/test/java/mobi/appcent/medusa/store/api/ReturnApiTest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/mobi/appcent/medusa/store/api/ReturnApi.java b/src/main/java/mobi/appcent/medusa/store/api/ReturnApi.java index dc73ffb..e23b527 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ReturnApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ReturnApi.java @@ -51,7 +51,7 @@ public void setApiClient(MedusaSdkClient medusaSdkClient) { * @return StoreReturnsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public CreateReturnRequest createReturn(StorePostReturnsReq body) throws ApiException { + public CreateReturnRequest createReturn() throws ApiException { return new CreateReturnRequest(medusaSdkClient); } } diff --git a/src/test/java/mobi/appcent/medusa/store/api/ProductVariantApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/ProductVariantApiTest.java index a341157..641531e 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/ProductVariantApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/ProductVariantApiTest.java @@ -69,7 +69,7 @@ public void getVariantsVariantTest() throws Exception { String salesChannelId = null; String regionId = null; String currencyCode = null; - StoreVariantsRes response = api.getVariantsVariant(variantId, cartId, salesChannelId, regionId, currencyCode); + StoreVariantsRes response = api.getVariant(variantId).execute().getData(); // TODO: test validations } diff --git a/src/test/java/mobi/appcent/medusa/store/api/ReturnApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/ReturnApiTest.java index ca1df47..802ac38 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/ReturnApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/ReturnApiTest.java @@ -37,7 +37,7 @@ public class ReturnApiTest { @Test public void postReturnsTest() throws Exception { StorePostReturnsReq body = null; - StoreReturnsRes response = api.postReturns(body); + StoreReturnsRes response = api.createReturn().execute().getData(); // TODO: test validations } From f18549c5cce82adbbd92e660af5a910298dbed9b Mon Sep 17 00:00:00 2001 From: erenalpaslan <45710175+ErenAlpaslan@users.noreply.github.com> Date: Sat, 11 Mar 2023 15:43:14 +0300 Subject: [PATCH 25/32] Feature/pipeline (#25) * feat(pipeline): Implement github actions flow and update pom * fix!(pipeline): Remove prerequisites from pom * fix!: Test issues * -Fix javadoc --- src/main/java/mobi/appcent/medusa/store/api/AuthApi.java | 1 + src/main/java/mobi/appcent/medusa/store/api/CustomerApi.java | 1 + src/main/java/mobi/appcent/medusa/store/api/InviteApi.java | 1 + src/main/java/mobi/appcent/medusa/store/api/OrderApi.java | 1 + src/main/java/mobi/appcent/medusa/store/api/ReturnApi.java | 2 +- 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/mobi/appcent/medusa/store/api/AuthApi.java b/src/main/java/mobi/appcent/medusa/store/api/AuthApi.java index 23b1dc5..33cfecb 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/AuthApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/AuthApi.java @@ -53,6 +53,7 @@ public void setApiClient(MedusaSdkClient medusaSdkClient) { /** * Customer Log out * Destroys a Customer's authenticated session. + * @return DeleteAuthRequest * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public DeleteAuthRequest deleteAuth() throws ApiException { diff --git a/src/main/java/mobi/appcent/medusa/store/api/CustomerApi.java b/src/main/java/mobi/appcent/medusa/store/api/CustomerApi.java index 2236805..5cb3566 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/CustomerApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/CustomerApi.java @@ -149,6 +149,7 @@ public UpdateShippingAddressRequest updateShippingAddress(String addressId) thro * Request Password Reset * Creates a reset password token to be used in a subsequent /reset-password request. The password token should be sent out of band e.g. via email and will not be returned. * body (optional) + * @return PasswordResetRequest * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public PasswordResetRequest passwordResetRequest() throws ApiException { diff --git a/src/main/java/mobi/appcent/medusa/store/api/InviteApi.java b/src/main/java/mobi/appcent/medusa/store/api/InviteApi.java index a52650d..8843853 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/InviteApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/InviteApi.java @@ -45,6 +45,7 @@ public void setApiClient(MedusaSdkClient medusaSdkClient) { * Claim an Order * Sends an email to emails registered to orders provided with link to transfer order ownership * body (optional) + * @return ClaimOrderRequest * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ClaimOrderRequest claimOrder() throws ApiException { diff --git a/src/main/java/mobi/appcent/medusa/store/api/OrderApi.java b/src/main/java/mobi/appcent/medusa/store/api/OrderApi.java index 1bf3a18..12b95de 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/OrderApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/OrderApi.java @@ -93,6 +93,7 @@ public GetOrderByCartIdRequest getOrderByCartId(String cartId) throws ApiExcepti * Verify an Order Claim * Verifies the claim order token provided to the customer upon request of order ownership * body (optional) + * @return VerifyOrderClaimRequest * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public VerifyOrderClaimRequest verifyOrderClaim() throws ApiException { diff --git a/src/main/java/mobi/appcent/medusa/store/api/ReturnApi.java b/src/main/java/mobi/appcent/medusa/store/api/ReturnApi.java index e23b527..c0dc584 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ReturnApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ReturnApi.java @@ -47,7 +47,7 @@ public void setApiClient(MedusaSdkClient medusaSdkClient) { /** * Create Return * Creates a Return for an Order. - * @param body (optional) + * body (optional) * @return StoreReturnsRes * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ From 0cccb061cddfb7c872c9734c457a949caab3bc21 Mon Sep 17 00:00:00 2001 From: Eren Date: Thu, 20 Apr 2023 21:39:21 +0300 Subject: [PATCH 26/32] feat(medusa-api): Adds cookie session management --- README.md | 111 +++++----- .../mobi/appcent/medusa/store/MedusaApi.java | 1 + .../appcent/medusa/store/MedusaSdkClient.java | 205 +++--------------- .../medusa/store/api/ProductTagApi.java | 13 -- .../store/auth/AddCookiesInterceptor.java | 40 ++++ .../appcent/medusa/store/auth/ApiKeyAuth.java | 73 ------- .../medusa/store/auth/Authentication.java | 28 --- .../medusa/store/auth/HttpBasicAuth.java | 51 ----- .../mobi/appcent/medusa/store/auth/OAuth.java | 38 ---- .../appcent/medusa/store/auth/OAuthFlow.java | 17 -- .../auth/ReceivedCookiesInterceptor.java | 28 +++ .../model/request/auth/DeleteAuthRequest.java | 3 +- .../request/auth/GetAuthEmailRequest.java | 2 +- .../model/request/auth/GetAuthRequest.java | 4 +- .../model/request/auth/PostAuthRequest.java | 3 +- .../request/cart/AddLineItemRequest.java | 2 +- .../cart/AddShippingMethodRequest.java | 2 +- .../cart/CalculateCartTaxesRequest.java | 2 +- .../request/cart/CompleteCartRequest.java | 2 +- .../model/request/cart/CreateCartRequest.java | 2 +- .../cart/CreatePaymentSessionsRequest.java | 2 +- .../request/cart/DeleteLineItemRequest.java | 2 +- .../cart/DeletePaymentSessionRequest.java | 2 +- .../model/request/cart/GetCartRequest.java | 2 +- .../cart/RefreshPaymentSessionRequest.java | 2 +- .../request/cart/RemoveDiscountRequest.java | 2 +- .../cart/SelectPaymentSessionRequest.java | 2 +- .../model/request/cart/UpdateCartRequest.java | 2 +- .../request/cart/UpdateLineItemRequest.java | 2 +- .../cart/UpdatePaymentSessionRequest.java | 2 +- .../collection/GetCollectionRequest.java | 2 +- .../collection/ListCollectionsRequest.java | 2 +- .../request/customer/AddShippingAddress.java | 3 +- .../customer/CreateCustomerRequest.java | 2 +- .../customer/DeleteAddressRequest.java | 3 +- .../request/customer/GetCustomerRequest.java | 3 +- .../customer/GetPaymentMethodsRequest.java | 3 +- .../request/customer/ListOrdersRequest.java | 4 +- .../customer/PasswordResetRequest.java | 2 +- .../customer/ResetPasswordRequest.java | 2 +- .../customer/UpdateCustomerRequest.java | 3 +- .../UpdateShippingAddressRequest.java | 3 +- .../giftcard/GetGiftCardByCodeRequest.java | 2 +- .../request/invite/ClaimOrderRequest.java | 3 +- .../order/GetOrderByCartIdRequest.java | 2 +- .../model/request/order/GetOrderRequest.java | 3 +- .../order/LookUpOrderByFiltersRequest.java | 3 +- .../order/VerifyOrderClaimRequest.java | 3 +- .../orderedit/CompletesOrderEditRequest.java | 2 +- .../orderedit/DeclineOrderEditRequest.java | 2 +- .../orderedit/RetrieveOrderEditRequest.java | 2 +- .../AuthorizePaymentSessionRequest.java | 3 +- .../AuthorizePaymentSessionsRequest.java | 3 +- .../GetPaymentCollectionRequest.java | 3 +- .../ManagePaymentSessionRequest.java | 3 +- .../ManagePaymentSessionsRequest.java | 3 +- .../RefreshPaymentSessionRequest.java | 2 +- .../request/product/GetProductRequest.java | 2 +- .../request/product/ListProductsRequest.java | 2 +- .../product/SearchProductsRequest.java | 2 +- .../GetProductCategoryRequest.java | 2 +- .../ListProductCategoriesRequest.java | 3 +- .../producttag/ListProductTagsRequest.java | 11 +- .../producttype/ListProductTypesRequest.java | 3 +- .../GetProductVariantRequest.java | 2 +- .../GetProductVariantsRequest.java | 2 +- .../request/region/GetRegionRequest.java | 2 +- .../request/region/ListRegionsRequest.java | 2 +- .../returnreason/GetReturnReasonRequest.java | 2 +- .../returnreason/ListReturnReasonRequest.java | 2 +- .../request/returns/CreateReturnRequest.java | 2 +- .../GetShippingOptionsByCartIdRequest.java | 2 +- .../GetShippingOptionsRequest.java | 2 +- .../model/request/swap/CreateSwapRequest.java | 2 +- .../request/swap/GetSwapByCartIdRequest.java | 2 +- ...ponse200.java => ProductTagsResponse.java} | 20 +- .../medusa/store/api/ProductTagApiTest.java | 4 +- 77 files changed, 233 insertions(+), 556 deletions(-) create mode 100644 src/main/java/mobi/appcent/medusa/store/auth/AddCookiesInterceptor.java delete mode 100644 src/main/java/mobi/appcent/medusa/store/auth/ApiKeyAuth.java delete mode 100644 src/main/java/mobi/appcent/medusa/store/auth/Authentication.java delete mode 100644 src/main/java/mobi/appcent/medusa/store/auth/HttpBasicAuth.java delete mode 100644 src/main/java/mobi/appcent/medusa/store/auth/OAuth.java delete mode 100644 src/main/java/mobi/appcent/medusa/store/auth/OAuthFlow.java create mode 100644 src/main/java/mobi/appcent/medusa/store/auth/ReceivedCookiesInterceptor.java rename src/main/java/mobi/appcent/medusa/store/model/response/{InlineResponse200.java => ProductTagsResponse.java} (94%) diff --git a/README.md b/README.md index 91496fe..3c35852 100644 --- a/README.md +++ b/README.md @@ -131,30 +131,29 @@ Please follow the [installation](#installation) instruction and execute the foll import mobi.appcent.medusa.store.MedusaSdkClient; import mobi.appcent.medusa.store.ApiException; import mobi.appcent.medusa.store.api.AuthApi; -import mobi.appcent.medusa.store.auth.ApiKeyAuth; import mobi.appcent.medusa.store.model.response.StoreAuthRes; import mobi.appcent.medusa.store.model.response.StoreGetAuthEmailRes; import mobi.appcent.medusa.store.model.response.StorePostAuthReq; public class AuthApiExample { - public static void main(String[] args) { - MedusaSdkClient defaultClient = Configuration.getDefaultApiClient(); - - // Configure API key authorization: cookie_auth - ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); - cookie_auth.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //cookie_auth.setApiKeyPrefix("Token"); - - AuthApi apiInstance = new AuthApi(); - try { - apiInstance.deleteAuth(); - } catch (ApiException e) { - System.err.println("Exception when calling AuthApi#deleteAuth"); - e.printStackTrace(); + public static void main(String[] args) { + MedusaSdkClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure API key authorization: cookie_auth + ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); + cookie_auth.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //cookie_auth.setApiKeyPrefix("Token"); + + AuthApi apiInstance = new AuthApi(); + try { + apiInstance.deleteAuth(); + } catch (ApiException e) { + System.err.println("Exception when calling AuthApi#deleteAuth"); + e.printStackTrace(); + } } - } } import mobi.appcent.medusa.store.*; import mobi.appcent.medusa.store.auth.*; @@ -166,24 +165,24 @@ import mobi.appcent.medusa.store.*; public class AuthApiExample { - public static void main(String[] args) { - MedusaSdkClient defaultClient = Configuration.getDefaultApiClient(); - - // Configure API key authorization: cookie_auth - ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); - cookie_auth.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //cookie_auth.setApiKeyPrefix("Token"); - - AuthApi apiInstance = new AuthApi(); - try { - StoreAuthRes result = apiInstance.getAuth(); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling AuthApi#getAuth"); - e.printStackTrace(); + public static void main(String[] args) { + MedusaSdkClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure API key authorization: cookie_auth + ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); + cookie_auth.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //cookie_auth.setApiKeyPrefix("Token"); + + AuthApi apiInstance = new AuthApi(); + try { + StoreAuthRes result = apiInstance.getAuth(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AuthApi#getAuth"); + e.printStackTrace(); + } } - } } import mobi.appcent.medusa.store.*; import mobi.appcent.medusa.store.auth.*; @@ -195,18 +194,18 @@ import mobi.appcent.medusa.store.*; public class AuthApiExample { - public static void main(String[] args) { - - AuthApi apiInstance = new AuthApi(); - String email = "email_example"; // String | The email to check if exists. - try { - StoreGetAuthEmailRes result = apiInstance.getAuthEmail(email); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling AuthApi#getAuthEmail"); - e.printStackTrace(); + public static void main(String[] args) { + + AuthApi apiInstance = new AuthApi(); + String email = "email_example"; // String | The email to check if exists. + try { + StoreGetAuthEmailRes result = apiInstance.getAuthEmail(email); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AuthApi#getAuthEmail"); + e.printStackTrace(); + } } - } } import mobi.appcent.medusa.store.*; import mobi.appcent.medusa.store.auth.*; @@ -218,18 +217,18 @@ import mobi.appcent.medusa.store.*; public class AuthApiExample { - public static void main(String[] args) { - - AuthApi apiInstance = new AuthApi(); - StorePostAuthReq body = new StorePostAuthReq(); // StorePostAuthReq | - try { - StoreAuthRes result = apiInstance.postAuth(body); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling AuthApi#postAuth"); - e.printStackTrace(); + public static void main(String[] args) { + + AuthApi apiInstance = new AuthApi(); + StorePostAuthReq body = new StorePostAuthReq(); // StorePostAuthReq | + try { + StoreAuthRes result = apiInstance.postAuth(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AuthApi#postAuth"); + e.printStackTrace(); + } } - } } ``` diff --git a/src/main/java/mobi/appcent/medusa/store/MedusaApi.java b/src/main/java/mobi/appcent/medusa/store/MedusaApi.java index 4e3e2c3..ddf0d74 100644 --- a/src/main/java/mobi/appcent/medusa/store/MedusaApi.java +++ b/src/main/java/mobi/appcent/medusa/store/MedusaApi.java @@ -42,6 +42,7 @@ private void initializeSdkClients() { orderEditApi.setApiClient(defaultMedusaSdkClient); paymentCollectionApi.setApiClient(defaultMedusaSdkClient); productApi.setApiClient(defaultMedusaSdkClient); + productTagApi.setApiClient(defaultMedusaSdkClient); productTypeApi.setApiClient(defaultMedusaSdkClient); productVariantApi.setApiClient(defaultMedusaSdkClient); regionApi.setApiClient(defaultMedusaSdkClient); diff --git a/src/main/java/mobi/appcent/medusa/store/MedusaSdkClient.java b/src/main/java/mobi/appcent/medusa/store/MedusaSdkClient.java index 3119e41..ebbb465 100644 --- a/src/main/java/mobi/appcent/medusa/store/MedusaSdkClient.java +++ b/src/main/java/mobi/appcent/medusa/store/MedusaSdkClient.java @@ -16,6 +16,7 @@ import com.squareup.okhttp.internal.http.HttpMethod; import com.squareup.okhttp.logging.HttpLoggingInterceptor; import com.squareup.okhttp.logging.HttpLoggingInterceptor.Level; +import mobi.appcent.medusa.store.auth.*; import okio.BufferedSink; import okio.Okio; import org.threeten.bp.LocalDate; @@ -27,6 +28,8 @@ import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; +import java.net.CookieHandler; +import java.net.URI; import java.nio.file.Files; import java.nio.file.Paths; import java.lang.reflect.Type; @@ -46,11 +49,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import mobi.appcent.medusa.store.auth.Authentication; -import mobi.appcent.medusa.store.auth.HttpBasicAuth; -import mobi.appcent.medusa.store.auth.ApiKeyAuth; -import mobi.appcent.medusa.store.auth.OAuth; - public class MedusaSdkClient { private String basePath = "https://api.medusa-commerce.com/store"; @@ -58,8 +56,6 @@ public class MedusaSdkClient { private Map defaultHeaderMap = new HashMap(); private String tempFolderPath = null; - private Map authentications; - private DateFormat dateFormat; private DateFormat datetimeFormat; private boolean lenientDatetimeFormat; @@ -73,26 +69,20 @@ public class MedusaSdkClient { private JSON json; private HttpLoggingInterceptor loggingInterceptor; + private String authCookie = null; + private String publishableApiKey = null; /* * Constructor for ApiClient */ public MedusaSdkClient() { httpClient = new OkHttpClient(); - + httpClient.interceptors().add(new AddCookiesInterceptor(this)); + httpClient.interceptors().add(new ReceivedCookiesInterceptor(this)); verifyingSsl = true; json = new JSON(); - - // Set default User-Agent. - setUserAgent("Swagger-Codegen/1.0.0/java"); - - // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap(); - authentications.put("cookie_auth", new ApiKeyAuth("query", "connect.sid")); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); } /** @@ -246,100 +236,6 @@ public MedusaSdkClient setLenientOnJson(boolean lenientOnJson) { return this; } - /** - * Get authentications (key: authentication name, value: authentication). - * - * @return Map of authentication objects - */ - public Map getAuthentications() { - return authentications; - } - - /** - * Get authentication for the given name. - * - * @param authName The authentication name - * @return The authentication, null if not found - */ - public Authentication getAuthentication(String authName) { - return authentications.get(authName); - } - - /** - * Helper method to set username for the first HTTP basic authentication. - * - * @param username Username - */ - public void setUsername(String username) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setUsername(username); - return; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set password for the first HTTP basic authentication. - * - * @param password Password - */ - public void setPassword(String password) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setPassword(password); - return; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set API key value for the first API key authentication. - * - * @param apiKey API key - */ - public void setApiKey(String apiKey) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKey(apiKey); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set API key prefix for the first API key authentication. - * - * @param apiKeyPrefix API key prefix - */ - public void setApiKeyPrefix(String apiKeyPrefix) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set access token for the first OAuth2 authentication. - * - * @param accessToken Access token - */ - public void setAccessToken(String accessToken) { - for (Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).setAccessToken(accessToken); - return; - } - } - throw new RuntimeException("No OAuth2 authentication configured!"); - } - /** * Set the User-Agent header's value (by adding to the default header map). * @@ -937,8 +833,6 @@ public T handleResponse(Response response, Type returnType) throws ApiExcept * @param body The request body object * @param headerParams The header parameters * @param formParams The form parameters - * @param authNames The authentications to apply - * @param progressRequestListener Progress request listener * @return The HTTP call * @throws ApiException If fail to serialize the request body object */ @@ -949,40 +843,9 @@ public Call buildCall( List collectionQueryParams, Object body, Map headerParams, - Map formParams, - String[] authNames, - ProgressRequestBody.ProgressRequestListener progressRequestListener + Map formParams ) throws ApiException { - Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams, authNames, progressRequestListener); - - return httpClient.newCall(request); - } - - /** - * Build HTTP call with the given options. - * - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param formParams The form parameters - * @param authNames The authentications to apply - * @return The HTTP call - * @throws ApiException If fail to serialize the request body object - */ - public Call buildCall( - String path, - String method, - List queryParams, - List collectionQueryParams, - Object body, - Map headerParams, - Map formParams, - String[] authNames - ) throws ApiException { - Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams, authNames, null); + Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams); return httpClient.newCall(request); } @@ -997,16 +860,10 @@ public Call buildCall( * @param body The request body object * @param headerParams The header parameters * @param formParams The form parameters - * @param authNames The authentications to apply - * @param progressRequestListener Progress request listener * @return The HTTP request * @throws ApiException If fail to serialize the request body object */ - public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - if (authNames == null) - authNames = new String[] { }; - updateParamsForAuth(authNames, queryParams, headerParams); - + public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map formParams) throws ApiException { final String url = buildUrl(path, queryParams, collectionQueryParams); final Request.Builder reqBuilder = new Request.Builder().url(url); processHeaderParams(headerParams, reqBuilder); @@ -1036,16 +893,7 @@ public Request buildRequest(String path, String method, List queryParams, reqBody = serialize(body, contentType); } - Request request = null; - - if(progressRequestListener != null && reqBody != null) { - ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener); - request = reqBuilder.method(method, progressRequestBody).build(); - } else { - request = reqBuilder.method(method, reqBody).build(); - } - - return request; + return reqBuilder.method(method, reqBody).build(); } /** @@ -1114,21 +962,6 @@ public void processHeaderParams(Map headerParams, Request.Builde } } - /** - * Update query and header parameters based on authentication settings. - * - * @param authNames The authentications to apply - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - */ - public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { - for (String authName : authNames) { - Authentication auth = authentications.get(authName); - if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); - auth.applyToParams(queryParams, headerParams); - } - } - /** * Build a form-encoding request body with the given form parameters. * @@ -1244,4 +1077,20 @@ private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityExcepti throw new AssertionError(e); } } + + public String getAuth() { + return authCookie; + } + + public void setAuth(String auth) { + this.authCookie = auth; + } + + public String getPublishableApiKey() { + return publishableApiKey; + } + + public void setPublishableApiKey(String apiKey) { + this.publishableApiKey = apiKey; + } } diff --git a/src/main/java/mobi/appcent/medusa/store/api/ProductTagApi.java b/src/main/java/mobi/appcent/medusa/store/api/ProductTagApi.java index 6a78a9e..ed5354d 100644 --- a/src/main/java/mobi/appcent/medusa/store/api/ProductTagApi.java +++ b/src/main/java/mobi/appcent/medusa/store/api/ProductTagApi.java @@ -15,21 +15,8 @@ import mobi.appcent.medusa.store.*; import mobi.appcent.medusa.store.MedusaSdkClient; -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - import mobi.appcent.medusa.store.model.request.producttag.ListProductTagsRequest; -import mobi.appcent.medusa.store.model.response.CreatedAt2; -import mobi.appcent.medusa.store.model.response.InlineResponse200; -import mobi.appcent.medusa.store.model.response.UpdatedAt2; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; public class ProductTagApi { private MedusaSdkClient medusaSdkClient; diff --git a/src/main/java/mobi/appcent/medusa/store/auth/AddCookiesInterceptor.java b/src/main/java/mobi/appcent/medusa/store/auth/AddCookiesInterceptor.java new file mode 100644 index 0000000..42f271a --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/auth/AddCookiesInterceptor.java @@ -0,0 +1,40 @@ +package mobi.appcent.medusa.store.auth; + +import com.squareup.okhttp.Interceptor; +import com.squareup.okhttp.Request; +import com.squareup.okhttp.Response; +import mobi.appcent.medusa.store.MedusaSdkClient; + +import java.io.IOException; +import java.util.HashSet; + +public class AddCookiesInterceptor implements Interceptor { + + private MedusaSdkClient client; + + public AddCookiesInterceptor(MedusaSdkClient client) { + this.client = client; + } + + @Override + public Response intercept(Chain chain) throws IOException { + Request.Builder builder = chain.request().newBuilder(); + String authCookie = client.getAuth(); + String publishableApiKey = client.getPublishableApiKey(); + if (authCookie != null) { + builder.addHeader("Cookie", authCookie); + if (client.isDebugging()) { + System.out.println("OkHttp" + " Adding Header: " + authCookie); + } + } + + if (publishableApiKey != null) { + builder.addHeader("x-publishable-api-key", publishableApiKey); + if (client.isDebugging()) { + System.out.println("OkHttp" + " Adding Header: " + publishableApiKey); + } + } + + return chain.proceed(builder.build()); + } +} \ No newline at end of file diff --git a/src/main/java/mobi/appcent/medusa/store/auth/ApiKeyAuth.java b/src/main/java/mobi/appcent/medusa/store/auth/ApiKeyAuth.java deleted file mode 100644 index 1a01032..0000000 --- a/src/main/java/mobi/appcent/medusa/store/auth/ApiKeyAuth.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Medusa Storefront API - * API reference for Medusa's Storefront endpoints. All endpoints are prefixed with `/store`. ## Authentication To send requests as an authenticated customer, you must use the Cookie Session ID. ## Expanding Fields In many endpoints you'll find an `expand` query parameter that can be passed to the endpoint. You can use the `expand` query parameter to unpack an entity's relations and return them in the response. Please note that the relations you pass to `expand` replace any relations that are expanded by default in the request. ### Expanding One Relation For example, when you retrieve a product, you can retrieve its collection by passing to the `expand` query parameter the value `collection`: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand=collection\" ``` ### Expanding Multiple Relations You can expand more than one relation by separating the relations in the `expand` query parameter with a comma. For example, to retrieve both the variants and the collection of a product, pass to the `expand` query parameter the value `variants,collection`: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand=variants,collection\" ``` ### Prevent Expanding Relations Some requests expand relations by default. You can prevent that by passing an empty expand value to retrieve an entity without any extra relations. For example: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand\" ``` This would retrieve the product with only its properties, without any relations like `collection`. ## Selecting Fields In many endpoints you'll find a `fields` query parameter that can be passed to the endpoint. You can use the `fields` query parameter to specify which fields in the entity should be returned in the response. Please note that if you pass a `fields` query parameter, only the fields you pass in the value along with the `id` of the entity will be returned in the response. Also, the `fields` query parameter does not affect the expanded relations. You'll have to use the `expand` parameter instead. ### Selecting One Field For example, when you retrieve a list of products, you can retrieve only the titles of the products by passing `title` as a value to the `fields` query parameter: ```bash curl \"http://localhost:9000/store/products?fields=title\" ``` As mentioned above, the expanded relations such as `variants` will still be returned as they're not affected by the `fields` parameter. You can ensure that only the `title` field is returned by passing an empty value to the `expand` query parameter. For example: ```bash curl \"http://localhost:9000/store/products?fields=title&expand\" ``` ### Selecting Multiple Fields You can pass more than one field by seperating the field names in the `fields` query parameter with a comma. For example, to select the `title` and `handle` of a product: ```bash curl \"http://localhost:9000/store/products?fields=title,handle\" ``` ### Retrieve Only the ID You can pass an empty `fields` query parameter to return only the ID of an entity. For example: ```bash curl \"http://localhost:9000/store/products?fields\" ``` You can also pair with an empty `expand` query parameter to ensure that the relations aren't retrieved as well. For example: ```bash curl \"http://localhost:9000/store/products?fields&expand\" ``` ## Query Parameter Types This section covers how to pass some common data types as query parameters. This is useful if you're sending requests to the API endpoints and not using our JS Client. For example, when using cURL or Postman. ### Strings You can pass a string value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?title=Shirt\" ``` If the string has any characters other than letters and numbers, you must encode them. For example, if the string has spaces, you can encode the space with `+` or `%20`: ```bash curl \"http://localhost:9000/store/products?title=Blue%20Shirt\" ``` You can use tools like [this one](https://www.urlencoder.org/) to learn how a value can be encoded. ### Integers You can pass an integer value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?offset=1\" ``` ### Boolean You can pass a boolean value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?is_giftcard=true\" ``` ### Date and DateTime You can pass a date value in the form `=`. The date must be in the format `YYYY-MM-DD`. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17\" ``` You can also pass the time using the format `YYYY-MM-DDTHH:MM:SSZ`. Please note that the `T` and `Z` here are fixed. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17T07:22:30Z\" ``` ### Array Each array value must be passed as a separate query parameter in the form `[]=`. You can also specify the index of each parameter in the brackets `[0]=`. For example: ```bash curl -g \"http://localhost:9000/store/products?sales_channel_id[]=sc_01GPGVB42PZ7N3YQEP2WDM7PC7&sales_channel_id[]=sc_234PGVB42PZ7N3YQEP2WDM7PC7\" ``` Note that the `-g` parameter passed to `curl` disables errors being thrown for using the brackets. Read more [here](https://curl.se/docs/manpage.html#-g). ### Object Object parameters must be passed as separate query parameters in the form `[]=`. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17&created_at[gt]=2022-09-17\" ``` ## Pagination ### Query Parameters In listing endpoints, such as list customers or list products, you can control the pagination using the query parameters `limit` and `offset`. `limit` is used to specify the maximum number of items that can be return in the response. `offset` is used to specify how many items to skip before returning the resulting entities. You can use the `offset` query parameter to change between pages. For example, if the limit is 50, at page 1 the offset should be 0; at page 2 the offset should be 50, and so on. For example, to limit the number of products returned in the List Products endpoint: ```bash curl \"http://localhost:9000/store/products?limit=5\" ``` ### Response Fields In the response of listing endpoints, aside from the entities retrieved, there are three pagination-related fields returned: `count`, `limit`, and `offset`. Similar to the query parameters, `limit` is the maximum number of items that can be returned in the response, and `field` is the number of items that were skipped before the entities in the result. `count` is the total number of available items of this entity. It can be used to determine how many pages are there. For example, if the `count` is 100 and the `limit` is 50, you can divide the `count` by the `limit` to get the number of pages: `100/50 = 2 pages`. - * - * OpenAPI spec version: 1.0.0 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - -package mobi.appcent.medusa.store.auth; - -import mobi.appcent.medusa.store.Pair; - -import java.util.Map; -import java.util.List; - -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2023-02-24T12:45:51.835798768Z[GMT]")public class ApiKeyAuth implements Authentication { - private final String location; - private final String paramName; - - private String apiKey; - private String apiKeyPrefix; - - public ApiKeyAuth(String location, String paramName) { - this.location = location; - this.paramName = paramName; - } - - public String getLocation() { - return location; - } - - public String getParamName() { - return paramName; - } - - public String getApiKey() { - return apiKey; - } - - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } - - public String getApiKeyPrefix() { - return apiKeyPrefix; - } - - public void setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; - } - - @Override - public void applyToParams(List queryParams, Map headerParams) { - if (apiKey == null) { - return; - } - String value; - if (apiKeyPrefix != null) { - value = apiKeyPrefix + " " + apiKey; - } else { - value = apiKey; - } - if ("query".equals(location)) { - queryParams.add(new Pair(paramName, value)); - } else if ("header".equals(location)) { - headerParams.put(paramName, value); - } - } -} diff --git a/src/main/java/mobi/appcent/medusa/store/auth/Authentication.java b/src/main/java/mobi/appcent/medusa/store/auth/Authentication.java deleted file mode 100644 index 4d3dbef..0000000 --- a/src/main/java/mobi/appcent/medusa/store/auth/Authentication.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Medusa Storefront API - * API reference for Medusa's Storefront endpoints. All endpoints are prefixed with `/store`. ## Authentication To send requests as an authenticated customer, you must use the Cookie Session ID. ## Expanding Fields In many endpoints you'll find an `expand` query parameter that can be passed to the endpoint. You can use the `expand` query parameter to unpack an entity's relations and return them in the response. Please note that the relations you pass to `expand` replace any relations that are expanded by default in the request. ### Expanding One Relation For example, when you retrieve a product, you can retrieve its collection by passing to the `expand` query parameter the value `collection`: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand=collection\" ``` ### Expanding Multiple Relations You can expand more than one relation by separating the relations in the `expand` query parameter with a comma. For example, to retrieve both the variants and the collection of a product, pass to the `expand` query parameter the value `variants,collection`: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand=variants,collection\" ``` ### Prevent Expanding Relations Some requests expand relations by default. You can prevent that by passing an empty expand value to retrieve an entity without any extra relations. For example: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand\" ``` This would retrieve the product with only its properties, without any relations like `collection`. ## Selecting Fields In many endpoints you'll find a `fields` query parameter that can be passed to the endpoint. You can use the `fields` query parameter to specify which fields in the entity should be returned in the response. Please note that if you pass a `fields` query parameter, only the fields you pass in the value along with the `id` of the entity will be returned in the response. Also, the `fields` query parameter does not affect the expanded relations. You'll have to use the `expand` parameter instead. ### Selecting One Field For example, when you retrieve a list of products, you can retrieve only the titles of the products by passing `title` as a value to the `fields` query parameter: ```bash curl \"http://localhost:9000/store/products?fields=title\" ``` As mentioned above, the expanded relations such as `variants` will still be returned as they're not affected by the `fields` parameter. You can ensure that only the `title` field is returned by passing an empty value to the `expand` query parameter. For example: ```bash curl \"http://localhost:9000/store/products?fields=title&expand\" ``` ### Selecting Multiple Fields You can pass more than one field by seperating the field names in the `fields` query parameter with a comma. For example, to select the `title` and `handle` of a product: ```bash curl \"http://localhost:9000/store/products?fields=title,handle\" ``` ### Retrieve Only the ID You can pass an empty `fields` query parameter to return only the ID of an entity. For example: ```bash curl \"http://localhost:9000/store/products?fields\" ``` You can also pair with an empty `expand` query parameter to ensure that the relations aren't retrieved as well. For example: ```bash curl \"http://localhost:9000/store/products?fields&expand\" ``` ## Query Parameter Types This section covers how to pass some common data types as query parameters. This is useful if you're sending requests to the API endpoints and not using our JS Client. For example, when using cURL or Postman. ### Strings You can pass a string value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?title=Shirt\" ``` If the string has any characters other than letters and numbers, you must encode them. For example, if the string has spaces, you can encode the space with `+` or `%20`: ```bash curl \"http://localhost:9000/store/products?title=Blue%20Shirt\" ``` You can use tools like [this one](https://www.urlencoder.org/) to learn how a value can be encoded. ### Integers You can pass an integer value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?offset=1\" ``` ### Boolean You can pass a boolean value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?is_giftcard=true\" ``` ### Date and DateTime You can pass a date value in the form `=`. The date must be in the format `YYYY-MM-DD`. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17\" ``` You can also pass the time using the format `YYYY-MM-DDTHH:MM:SSZ`. Please note that the `T` and `Z` here are fixed. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17T07:22:30Z\" ``` ### Array Each array value must be passed as a separate query parameter in the form `[]=`. You can also specify the index of each parameter in the brackets `[0]=`. For example: ```bash curl -g \"http://localhost:9000/store/products?sales_channel_id[]=sc_01GPGVB42PZ7N3YQEP2WDM7PC7&sales_channel_id[]=sc_234PGVB42PZ7N3YQEP2WDM7PC7\" ``` Note that the `-g` parameter passed to `curl` disables errors being thrown for using the brackets. Read more [here](https://curl.se/docs/manpage.html#-g). ### Object Object parameters must be passed as separate query parameters in the form `[]=`. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17&created_at[gt]=2022-09-17\" ``` ## Pagination ### Query Parameters In listing endpoints, such as list customers or list products, you can control the pagination using the query parameters `limit` and `offset`. `limit` is used to specify the maximum number of items that can be return in the response. `offset` is used to specify how many items to skip before returning the resulting entities. You can use the `offset` query parameter to change between pages. For example, if the limit is 50, at page 1 the offset should be 0; at page 2 the offset should be 50, and so on. For example, to limit the number of products returned in the List Products endpoint: ```bash curl \"http://localhost:9000/store/products?limit=5\" ``` ### Response Fields In the response of listing endpoints, aside from the entities retrieved, there are three pagination-related fields returned: `count`, `limit`, and `offset`. Similar to the query parameters, `limit` is the maximum number of items that can be returned in the response, and `field` is the number of items that were skipped before the entities in the result. `count` is the total number of available items of this entity. It can be used to determine how many pages are there. For example, if the `count` is 100 and the `limit` is 50, you can divide the `count` by the `limit` to get the number of pages: `100/50 = 2 pages`. - * - * OpenAPI spec version: 1.0.0 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - -package mobi.appcent.medusa.store.auth; - -import mobi.appcent.medusa.store.Pair; - -import java.util.Map; -import java.util.List; - -public interface Authentication { - /** - * Apply authentication settings to header and query params. - * - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - */ - void applyToParams(List queryParams, Map headerParams); -} diff --git a/src/main/java/mobi/appcent/medusa/store/auth/HttpBasicAuth.java b/src/main/java/mobi/appcent/medusa/store/auth/HttpBasicAuth.java deleted file mode 100644 index 321e9f5..0000000 --- a/src/main/java/mobi/appcent/medusa/store/auth/HttpBasicAuth.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Medusa Storefront API - * API reference for Medusa's Storefront endpoints. All endpoints are prefixed with `/store`. ## Authentication To send requests as an authenticated customer, you must use the Cookie Session ID. ## Expanding Fields In many endpoints you'll find an `expand` query parameter that can be passed to the endpoint. You can use the `expand` query parameter to unpack an entity's relations and return them in the response. Please note that the relations you pass to `expand` replace any relations that are expanded by default in the request. ### Expanding One Relation For example, when you retrieve a product, you can retrieve its collection by passing to the `expand` query parameter the value `collection`: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand=collection\" ``` ### Expanding Multiple Relations You can expand more than one relation by separating the relations in the `expand` query parameter with a comma. For example, to retrieve both the variants and the collection of a product, pass to the `expand` query parameter the value `variants,collection`: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand=variants,collection\" ``` ### Prevent Expanding Relations Some requests expand relations by default. You can prevent that by passing an empty expand value to retrieve an entity without any extra relations. For example: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand\" ``` This would retrieve the product with only its properties, without any relations like `collection`. ## Selecting Fields In many endpoints you'll find a `fields` query parameter that can be passed to the endpoint. You can use the `fields` query parameter to specify which fields in the entity should be returned in the response. Please note that if you pass a `fields` query parameter, only the fields you pass in the value along with the `id` of the entity will be returned in the response. Also, the `fields` query parameter does not affect the expanded relations. You'll have to use the `expand` parameter instead. ### Selecting One Field For example, when you retrieve a list of products, you can retrieve only the titles of the products by passing `title` as a value to the `fields` query parameter: ```bash curl \"http://localhost:9000/store/products?fields=title\" ``` As mentioned above, the expanded relations such as `variants` will still be returned as they're not affected by the `fields` parameter. You can ensure that only the `title` field is returned by passing an empty value to the `expand` query parameter. For example: ```bash curl \"http://localhost:9000/store/products?fields=title&expand\" ``` ### Selecting Multiple Fields You can pass more than one field by seperating the field names in the `fields` query parameter with a comma. For example, to select the `title` and `handle` of a product: ```bash curl \"http://localhost:9000/store/products?fields=title,handle\" ``` ### Retrieve Only the ID You can pass an empty `fields` query parameter to return only the ID of an entity. For example: ```bash curl \"http://localhost:9000/store/products?fields\" ``` You can also pair with an empty `expand` query parameter to ensure that the relations aren't retrieved as well. For example: ```bash curl \"http://localhost:9000/store/products?fields&expand\" ``` ## Query Parameter Types This section covers how to pass some common data types as query parameters. This is useful if you're sending requests to the API endpoints and not using our JS Client. For example, when using cURL or Postman. ### Strings You can pass a string value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?title=Shirt\" ``` If the string has any characters other than letters and numbers, you must encode them. For example, if the string has spaces, you can encode the space with `+` or `%20`: ```bash curl \"http://localhost:9000/store/products?title=Blue%20Shirt\" ``` You can use tools like [this one](https://www.urlencoder.org/) to learn how a value can be encoded. ### Integers You can pass an integer value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?offset=1\" ``` ### Boolean You can pass a boolean value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?is_giftcard=true\" ``` ### Date and DateTime You can pass a date value in the form `=`. The date must be in the format `YYYY-MM-DD`. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17\" ``` You can also pass the time using the format `YYYY-MM-DDTHH:MM:SSZ`. Please note that the `T` and `Z` here are fixed. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17T07:22:30Z\" ``` ### Array Each array value must be passed as a separate query parameter in the form `[]=`. You can also specify the index of each parameter in the brackets `[0]=`. For example: ```bash curl -g \"http://localhost:9000/store/products?sales_channel_id[]=sc_01GPGVB42PZ7N3YQEP2WDM7PC7&sales_channel_id[]=sc_234PGVB42PZ7N3YQEP2WDM7PC7\" ``` Note that the `-g` parameter passed to `curl` disables errors being thrown for using the brackets. Read more [here](https://curl.se/docs/manpage.html#-g). ### Object Object parameters must be passed as separate query parameters in the form `[]=`. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17&created_at[gt]=2022-09-17\" ``` ## Pagination ### Query Parameters In listing endpoints, such as list customers or list products, you can control the pagination using the query parameters `limit` and `offset`. `limit` is used to specify the maximum number of items that can be return in the response. `offset` is used to specify how many items to skip before returning the resulting entities. You can use the `offset` query parameter to change between pages. For example, if the limit is 50, at page 1 the offset should be 0; at page 2 the offset should be 50, and so on. For example, to limit the number of products returned in the List Products endpoint: ```bash curl \"http://localhost:9000/store/products?limit=5\" ``` ### Response Fields In the response of listing endpoints, aside from the entities retrieved, there are three pagination-related fields returned: `count`, `limit`, and `offset`. Similar to the query parameters, `limit` is the maximum number of items that can be returned in the response, and `field` is the number of items that were skipped before the entities in the result. `count` is the total number of available items of this entity. It can be used to determine how many pages are there. For example, if the `count` is 100 and the `limit` is 50, you can divide the `count` by the `limit` to get the number of pages: `100/50 = 2 pages`. - * - * OpenAPI spec version: 1.0.0 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - -package mobi.appcent.medusa.store.auth; - -import mobi.appcent.medusa.store.Pair; - -import com.squareup.okhttp.Credentials; - -import java.util.Map; -import java.util.List; - -public class HttpBasicAuth implements Authentication { - private String username; - private String password; - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - @Override - public void applyToParams(List queryParams, Map headerParams) { - if (username == null && password == null) { - return; - } - headerParams.put("Authorization", Credentials.basic( - username == null ? "" : username, - password == null ? "" : password)); - } -} diff --git a/src/main/java/mobi/appcent/medusa/store/auth/OAuth.java b/src/main/java/mobi/appcent/medusa/store/auth/OAuth.java deleted file mode 100644 index c0ec2c8..0000000 --- a/src/main/java/mobi/appcent/medusa/store/auth/OAuth.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Medusa Storefront API - * API reference for Medusa's Storefront endpoints. All endpoints are prefixed with `/store`. ## Authentication To send requests as an authenticated customer, you must use the Cookie Session ID. ## Expanding Fields In many endpoints you'll find an `expand` query parameter that can be passed to the endpoint. You can use the `expand` query parameter to unpack an entity's relations and return them in the response. Please note that the relations you pass to `expand` replace any relations that are expanded by default in the request. ### Expanding One Relation For example, when you retrieve a product, you can retrieve its collection by passing to the `expand` query parameter the value `collection`: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand=collection\" ``` ### Expanding Multiple Relations You can expand more than one relation by separating the relations in the `expand` query parameter with a comma. For example, to retrieve both the variants and the collection of a product, pass to the `expand` query parameter the value `variants,collection`: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand=variants,collection\" ``` ### Prevent Expanding Relations Some requests expand relations by default. You can prevent that by passing an empty expand value to retrieve an entity without any extra relations. For example: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand\" ``` This would retrieve the product with only its properties, without any relations like `collection`. ## Selecting Fields In many endpoints you'll find a `fields` query parameter that can be passed to the endpoint. You can use the `fields` query parameter to specify which fields in the entity should be returned in the response. Please note that if you pass a `fields` query parameter, only the fields you pass in the value along with the `id` of the entity will be returned in the response. Also, the `fields` query parameter does not affect the expanded relations. You'll have to use the `expand` parameter instead. ### Selecting One Field For example, when you retrieve a list of products, you can retrieve only the titles of the products by passing `title` as a value to the `fields` query parameter: ```bash curl \"http://localhost:9000/store/products?fields=title\" ``` As mentioned above, the expanded relations such as `variants` will still be returned as they're not affected by the `fields` parameter. You can ensure that only the `title` field is returned by passing an empty value to the `expand` query parameter. For example: ```bash curl \"http://localhost:9000/store/products?fields=title&expand\" ``` ### Selecting Multiple Fields You can pass more than one field by seperating the field names in the `fields` query parameter with a comma. For example, to select the `title` and `handle` of a product: ```bash curl \"http://localhost:9000/store/products?fields=title,handle\" ``` ### Retrieve Only the ID You can pass an empty `fields` query parameter to return only the ID of an entity. For example: ```bash curl \"http://localhost:9000/store/products?fields\" ``` You can also pair with an empty `expand` query parameter to ensure that the relations aren't retrieved as well. For example: ```bash curl \"http://localhost:9000/store/products?fields&expand\" ``` ## Query Parameter Types This section covers how to pass some common data types as query parameters. This is useful if you're sending requests to the API endpoints and not using our JS Client. For example, when using cURL or Postman. ### Strings You can pass a string value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?title=Shirt\" ``` If the string has any characters other than letters and numbers, you must encode them. For example, if the string has spaces, you can encode the space with `+` or `%20`: ```bash curl \"http://localhost:9000/store/products?title=Blue%20Shirt\" ``` You can use tools like [this one](https://www.urlencoder.org/) to learn how a value can be encoded. ### Integers You can pass an integer value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?offset=1\" ``` ### Boolean You can pass a boolean value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?is_giftcard=true\" ``` ### Date and DateTime You can pass a date value in the form `=`. The date must be in the format `YYYY-MM-DD`. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17\" ``` You can also pass the time using the format `YYYY-MM-DDTHH:MM:SSZ`. Please note that the `T` and `Z` here are fixed. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17T07:22:30Z\" ``` ### Array Each array value must be passed as a separate query parameter in the form `[]=`. You can also specify the index of each parameter in the brackets `[0]=`. For example: ```bash curl -g \"http://localhost:9000/store/products?sales_channel_id[]=sc_01GPGVB42PZ7N3YQEP2WDM7PC7&sales_channel_id[]=sc_234PGVB42PZ7N3YQEP2WDM7PC7\" ``` Note that the `-g` parameter passed to `curl` disables errors being thrown for using the brackets. Read more [here](https://curl.se/docs/manpage.html#-g). ### Object Object parameters must be passed as separate query parameters in the form `[]=`. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17&created_at[gt]=2022-09-17\" ``` ## Pagination ### Query Parameters In listing endpoints, such as list customers or list products, you can control the pagination using the query parameters `limit` and `offset`. `limit` is used to specify the maximum number of items that can be return in the response. `offset` is used to specify how many items to skip before returning the resulting entities. You can use the `offset` query parameter to change between pages. For example, if the limit is 50, at page 1 the offset should be 0; at page 2 the offset should be 50, and so on. For example, to limit the number of products returned in the List Products endpoint: ```bash curl \"http://localhost:9000/store/products?limit=5\" ``` ### Response Fields In the response of listing endpoints, aside from the entities retrieved, there are three pagination-related fields returned: `count`, `limit`, and `offset`. Similar to the query parameters, `limit` is the maximum number of items that can be returned in the response, and `field` is the number of items that were skipped before the entities in the result. `count` is the total number of available items of this entity. It can be used to determine how many pages are there. For example, if the `count` is 100 and the `limit` is 50, you can divide the `count` by the `limit` to get the number of pages: `100/50 = 2 pages`. - * - * OpenAPI spec version: 1.0.0 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - -package mobi.appcent.medusa.store.auth; - -import mobi.appcent.medusa.store.Pair; - -import java.util.Map; -import java.util.List; - -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2023-02-24T12:45:51.835798768Z[GMT]") -public class OAuth implements Authentication { - private String accessToken; - - public String getAccessToken() { - return accessToken; - } - - public void setAccessToken(String accessToken) { - this.accessToken = accessToken; - } - - @Override - public void applyToParams(List queryParams, Map headerParams) { - if (accessToken != null) { - headerParams.put("Authorization", "Bearer " + accessToken); - } - } -} diff --git a/src/main/java/mobi/appcent/medusa/store/auth/OAuthFlow.java b/src/main/java/mobi/appcent/medusa/store/auth/OAuthFlow.java deleted file mode 100644 index 6661d6e..0000000 --- a/src/main/java/mobi/appcent/medusa/store/auth/OAuthFlow.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Medusa Storefront API - * API reference for Medusa's Storefront endpoints. All endpoints are prefixed with `/store`. ## Authentication To send requests as an authenticated customer, you must use the Cookie Session ID. ## Expanding Fields In many endpoints you'll find an `expand` query parameter that can be passed to the endpoint. You can use the `expand` query parameter to unpack an entity's relations and return them in the response. Please note that the relations you pass to `expand` replace any relations that are expanded by default in the request. ### Expanding One Relation For example, when you retrieve a product, you can retrieve its collection by passing to the `expand` query parameter the value `collection`: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand=collection\" ``` ### Expanding Multiple Relations You can expand more than one relation by separating the relations in the `expand` query parameter with a comma. For example, to retrieve both the variants and the collection of a product, pass to the `expand` query parameter the value `variants,collection`: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand=variants,collection\" ``` ### Prevent Expanding Relations Some requests expand relations by default. You can prevent that by passing an empty expand value to retrieve an entity without any extra relations. For example: ```bash curl \"http://localhost:9000/store/products/prod_01GDJGP2XPQT2N3JHZQFMH5V45?expand\" ``` This would retrieve the product with only its properties, without any relations like `collection`. ## Selecting Fields In many endpoints you'll find a `fields` query parameter that can be passed to the endpoint. You can use the `fields` query parameter to specify which fields in the entity should be returned in the response. Please note that if you pass a `fields` query parameter, only the fields you pass in the value along with the `id` of the entity will be returned in the response. Also, the `fields` query parameter does not affect the expanded relations. You'll have to use the `expand` parameter instead. ### Selecting One Field For example, when you retrieve a list of products, you can retrieve only the titles of the products by passing `title` as a value to the `fields` query parameter: ```bash curl \"http://localhost:9000/store/products?fields=title\" ``` As mentioned above, the expanded relations such as `variants` will still be returned as they're not affected by the `fields` parameter. You can ensure that only the `title` field is returned by passing an empty value to the `expand` query parameter. For example: ```bash curl \"http://localhost:9000/store/products?fields=title&expand\" ``` ### Selecting Multiple Fields You can pass more than one field by seperating the field names in the `fields` query parameter with a comma. For example, to select the `title` and `handle` of a product: ```bash curl \"http://localhost:9000/store/products?fields=title,handle\" ``` ### Retrieve Only the ID You can pass an empty `fields` query parameter to return only the ID of an entity. For example: ```bash curl \"http://localhost:9000/store/products?fields\" ``` You can also pair with an empty `expand` query parameter to ensure that the relations aren't retrieved as well. For example: ```bash curl \"http://localhost:9000/store/products?fields&expand\" ``` ## Query Parameter Types This section covers how to pass some common data types as query parameters. This is useful if you're sending requests to the API endpoints and not using our JS Client. For example, when using cURL or Postman. ### Strings You can pass a string value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?title=Shirt\" ``` If the string has any characters other than letters and numbers, you must encode them. For example, if the string has spaces, you can encode the space with `+` or `%20`: ```bash curl \"http://localhost:9000/store/products?title=Blue%20Shirt\" ``` You can use tools like [this one](https://www.urlencoder.org/) to learn how a value can be encoded. ### Integers You can pass an integer value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?offset=1\" ``` ### Boolean You can pass a boolean value in the form of `=`. For example: ```bash curl \"http://localhost:9000/store/products?is_giftcard=true\" ``` ### Date and DateTime You can pass a date value in the form `=`. The date must be in the format `YYYY-MM-DD`. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17\" ``` You can also pass the time using the format `YYYY-MM-DDTHH:MM:SSZ`. Please note that the `T` and `Z` here are fixed. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17T07:22:30Z\" ``` ### Array Each array value must be passed as a separate query parameter in the form `[]=`. You can also specify the index of each parameter in the brackets `[0]=`. For example: ```bash curl -g \"http://localhost:9000/store/products?sales_channel_id[]=sc_01GPGVB42PZ7N3YQEP2WDM7PC7&sales_channel_id[]=sc_234PGVB42PZ7N3YQEP2WDM7PC7\" ``` Note that the `-g` parameter passed to `curl` disables errors being thrown for using the brackets. Read more [here](https://curl.se/docs/manpage.html#-g). ### Object Object parameters must be passed as separate query parameters in the form `[]=`. For example: ```bash curl -g \"http://localhost:9000/store/products?created_at[lt]=2023-02-17&created_at[gt]=2022-09-17\" ``` ## Pagination ### Query Parameters In listing endpoints, such as list customers or list products, you can control the pagination using the query parameters `limit` and `offset`. `limit` is used to specify the maximum number of items that can be return in the response. `offset` is used to specify how many items to skip before returning the resulting entities. You can use the `offset` query parameter to change between pages. For example, if the limit is 50, at page 1 the offset should be 0; at page 2 the offset should be 50, and so on. For example, to limit the number of products returned in the List Products endpoint: ```bash curl \"http://localhost:9000/store/products?limit=5\" ``` ### Response Fields In the response of listing endpoints, aside from the entities retrieved, there are three pagination-related fields returned: `count`, `limit`, and `offset`. Similar to the query parameters, `limit` is the maximum number of items that can be returned in the response, and `field` is the number of items that were skipped before the entities in the result. `count` is the total number of available items of this entity. It can be used to determine how many pages are there. For example, if the `count` is 100 and the `limit` is 50, you can divide the `count` by the `limit` to get the number of pages: `100/50 = 2 pages`. - * - * OpenAPI spec version: 1.0.0 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - -package mobi.appcent.medusa.store.auth; - -public enum OAuthFlow { - accessCode, implicit, password, application -} diff --git a/src/main/java/mobi/appcent/medusa/store/auth/ReceivedCookiesInterceptor.java b/src/main/java/mobi/appcent/medusa/store/auth/ReceivedCookiesInterceptor.java new file mode 100644 index 0000000..aa7b167 --- /dev/null +++ b/src/main/java/mobi/appcent/medusa/store/auth/ReceivedCookiesInterceptor.java @@ -0,0 +1,28 @@ +package mobi.appcent.medusa.store.auth; + +import com.squareup.okhttp.Interceptor; +import com.squareup.okhttp.Response; +import mobi.appcent.medusa.store.MedusaSdkClient; + +import java.io.IOException; + +public class ReceivedCookiesInterceptor implements Interceptor { + + private MedusaSdkClient client; + + public ReceivedCookiesInterceptor(MedusaSdkClient client) { + this.client = client; + } + + @Override + public Response intercept(Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + + if (!originalResponse.headers("Set-Cookie").isEmpty()) { + String authCookie = originalResponse.headers("Set-Cookie").get(0); + client.setAuth(authCookie); + } + + return originalResponse; + } +} \ No newline at end of file diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/auth/DeleteAuthRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/auth/DeleteAuthRequest.java index fea9299..15454f2 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/auth/DeleteAuthRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/auth/DeleteAuthRequest.java @@ -34,8 +34,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.DELETE, null, null, null, headers, null, localVarAuthNames); + return client.buildCall(path, HttpMethod.DELETE, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/auth/GetAuthEmailRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/auth/GetAuthEmailRequest.java index 60ec047..d24df02 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/auth/GetAuthEmailRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/auth/GetAuthEmailRequest.java @@ -40,7 +40,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/auth/GetAuthRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/auth/GetAuthRequest.java index 564f601..4f2706e 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/auth/GetAuthRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/auth/GetAuthRequest.java @@ -33,8 +33,8 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, localVarAuthNames); + + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/auth/PostAuthRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/auth/PostAuthRequest.java index 4b50b84..7437e59 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/auth/PostAuthRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/auth/PostAuthRequest.java @@ -50,7 +50,8 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/AddLineItemRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/AddLineItemRequest.java index 2dba0b9..39c3293 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/cart/AddLineItemRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/AddLineItemRequest.java @@ -46,7 +46,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/AddShippingMethodRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/AddShippingMethodRequest.java index fb5bf73..bfbbbcf 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/cart/AddShippingMethodRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/AddShippingMethodRequest.java @@ -46,7 +46,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/CalculateCartTaxesRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/CalculateCartTaxesRequest.java index b5af574..44d2701 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/cart/CalculateCartTaxesRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/CalculateCartTaxesRequest.java @@ -39,7 +39,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/CompleteCartRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/CompleteCartRequest.java index e450786..7322029 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/cart/CompleteCartRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/CompleteCartRequest.java @@ -39,7 +39,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/CreateCartRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/CreateCartRequest.java index 33f49d2..e97c9a5 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/cart/CreateCartRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/CreateCartRequest.java @@ -44,7 +44,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/CreatePaymentSessionsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/CreatePaymentSessionsRequest.java index c83e770..2375128 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/cart/CreatePaymentSessionsRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/CreatePaymentSessionsRequest.java @@ -35,7 +35,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/DeleteLineItemRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/DeleteLineItemRequest.java index 3eda916..0d2de88 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/cart/DeleteLineItemRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/DeleteLineItemRequest.java @@ -37,7 +37,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.DELETE, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.DELETE, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/DeletePaymentSessionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/DeletePaymentSessionRequest.java index c3a55f6..cd53192 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/cart/DeletePaymentSessionRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/DeletePaymentSessionRequest.java @@ -38,7 +38,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.DELETE, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.DELETE, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/GetCartRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/GetCartRequest.java index 0bc3451..731de54 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/cart/GetCartRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/GetCartRequest.java @@ -39,7 +39,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/RefreshPaymentSessionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/RefreshPaymentSessionRequest.java index 1b5d878..48aae45 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/cart/RefreshPaymentSessionRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/RefreshPaymentSessionRequest.java @@ -41,7 +41,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/RemoveDiscountRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/RemoveDiscountRequest.java index 7227229..3b7ee78 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/cart/RemoveDiscountRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/RemoveDiscountRequest.java @@ -41,7 +41,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.DELETE, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.DELETE, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/SelectPaymentSessionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/SelectPaymentSessionRequest.java index 2d9502e..db95fb4 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/cart/SelectPaymentSessionRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/SelectPaymentSessionRequest.java @@ -43,7 +43,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdateCartRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdateCartRequest.java index 88c7d56..90c339b 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdateCartRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdateCartRequest.java @@ -46,7 +46,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdateLineItemRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdateLineItemRequest.java index d5ffda2..e4dc25b 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdateLineItemRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdateLineItemRequest.java @@ -48,7 +48,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdatePaymentSessionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdatePaymentSessionRequest.java index c0f41aa..060e892 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdatePaymentSessionRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/cart/UpdatePaymentSessionRequest.java @@ -45,7 +45,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/collection/GetCollectionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/collection/GetCollectionRequest.java index c713386..4028cd7 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/collection/GetCollectionRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/collection/GetCollectionRequest.java @@ -39,7 +39,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/collection/ListCollectionsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/collection/ListCollectionsRequest.java index 1f4788f..cfd9574 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/collection/ListCollectionsRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/collection/ListCollectionsRequest.java @@ -76,7 +76,7 @@ protected Call buildCall() throws ApiException { if (updatedAt != null) localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.UPDATED_AT, updatedAt)); - return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/AddShippingAddress.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/AddShippingAddress.java index c26526a..aba8953 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/customer/AddShippingAddress.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/AddShippingAddress.java @@ -39,8 +39,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, localVarAuthNames); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/CreateCustomerRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/CreateCustomerRequest.java index da91fd9..4ca433c 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/customer/CreateCustomerRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/CreateCustomerRequest.java @@ -40,7 +40,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/DeleteAddressRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/DeleteAddressRequest.java index 09d3a36..6f7de6e 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/customer/DeleteAddressRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/DeleteAddressRequest.java @@ -38,8 +38,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.DELETE, null, null, null, headers, null, localVarAuthNames); + return client.buildCall(path, HttpMethod.DELETE, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/GetCustomerRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/GetCustomerRequest.java index 37c5f46..35caa5b 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/customer/GetCustomerRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/GetCustomerRequest.java @@ -36,8 +36,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, localVarAuthNames); + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/GetPaymentMethodsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/GetPaymentMethodsRequest.java index 20c0ceb..a1a295b 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/customer/GetPaymentMethodsRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/GetPaymentMethodsRequest.java @@ -33,8 +33,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, localVarAuthNames); + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/ListOrdersRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/ListOrdersRequest.java index 127f8fa..bb2df86 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/customer/ListOrdersRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/ListOrdersRequest.java @@ -185,9 +185,7 @@ protected Call buildCall() throws ApiException { if (expand != null) localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.EXPAND, expand)); - - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.GET, localVarQueryParams, localVarCollectionQueryParams, null, headers, null, localVarAuthNames); + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, localVarCollectionQueryParams, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/PasswordResetRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/PasswordResetRequest.java index e788e33..8919477 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/customer/PasswordResetRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/PasswordResetRequest.java @@ -42,7 +42,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/ResetPasswordRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/ResetPasswordRequest.java index 8c03f37..637293c 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/customer/ResetPasswordRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/ResetPasswordRequest.java @@ -43,7 +43,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/UpdateCustomerRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/UpdateCustomerRequest.java index 25aa00a..042acb0 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/customer/UpdateCustomerRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/UpdateCustomerRequest.java @@ -43,8 +43,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, localVarAuthNames); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/customer/UpdateShippingAddressRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/customer/UpdateShippingAddressRequest.java index 3593387..f4c5b65 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/customer/UpdateShippingAddressRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/customer/UpdateShippingAddressRequest.java @@ -42,8 +42,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, localVarAuthNames); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/giftcard/GetGiftCardByCodeRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/giftcard/GetGiftCardByCodeRequest.java index 440ad94..2c5ab8b 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/giftcard/GetGiftCardByCodeRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/giftcard/GetGiftCardByCodeRequest.java @@ -38,7 +38,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/invite/ClaimOrderRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/invite/ClaimOrderRequest.java index 45bbdb6..59efa12 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/invite/ClaimOrderRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/invite/ClaimOrderRequest.java @@ -42,8 +42,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, localVarAuthNames); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderByCartIdRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderByCartIdRequest.java index 453325b..fa3b23c 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderByCartIdRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderByCartIdRequest.java @@ -39,7 +39,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderRequest.java index 8886175..b24e2a1 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/order/GetOrderRequest.java @@ -57,8 +57,7 @@ protected Call buildCall() throws ApiException { if (expand != null) localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.EXPAND, expand)); - - return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/order/LookUpOrderByFiltersRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/order/LookUpOrderByFiltersRequest.java index af31ed5..60d5763 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/order/LookUpOrderByFiltersRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/order/LookUpOrderByFiltersRequest.java @@ -72,8 +72,7 @@ protected Call buildCall() throws ApiException { if (shippingAddress != null) localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.SHIPPING_ADDRESS, shippingAddress)); - - return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/order/VerifyOrderClaimRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/order/VerifyOrderClaimRequest.java index 8fb5285..b2e357b 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/order/VerifyOrderClaimRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/order/VerifyOrderClaimRequest.java @@ -42,8 +42,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, localVarAuthNames); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/CompletesOrderEditRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/CompletesOrderEditRequest.java index d831c50..476bac8 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/CompletesOrderEditRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/CompletesOrderEditRequest.java @@ -38,7 +38,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/DeclineOrderEditRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/DeclineOrderEditRequest.java index 1415240..fecad5a 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/DeclineOrderEditRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/DeclineOrderEditRequest.java @@ -45,7 +45,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/RetrieveOrderEditRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/RetrieveOrderEditRequest.java index aa40cdb..1f99be3 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/RetrieveOrderEditRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/orderedit/RetrieveOrderEditRequest.java @@ -38,7 +38,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/AuthorizePaymentSessionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/AuthorizePaymentSessionRequest.java index cdb3b55..8bdef9b 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/AuthorizePaymentSessionRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/AuthorizePaymentSessionRequest.java @@ -40,8 +40,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null, localVarAuthNames); + return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/AuthorizePaymentSessionsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/AuthorizePaymentSessionsRequest.java index 6ac9476..89b7053 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/AuthorizePaymentSessionsRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/AuthorizePaymentSessionsRequest.java @@ -45,8 +45,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, localVarAuthNames); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/GetPaymentCollectionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/GetPaymentCollectionRequest.java index 7d5a8a1..d827644 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/GetPaymentCollectionRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/GetPaymentCollectionRequest.java @@ -55,8 +55,7 @@ protected Call buildCall() throws ApiException { if (fields != null) localVarQueryParams.addAll(client.parameterToPair("fields", fields)); - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, localVarAuthNames); + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/ManagePaymentSessionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/ManagePaymentSessionRequest.java index 112003c..2726d2e 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/ManagePaymentSessionRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/ManagePaymentSessionRequest.java @@ -45,8 +45,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, localVarAuthNames); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/ManagePaymentSessionsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/ManagePaymentSessionsRequest.java index 99ca119..7687fa6 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/ManagePaymentSessionsRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/ManagePaymentSessionsRequest.java @@ -45,8 +45,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, localVarAuthNames); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/RefreshPaymentSessionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/RefreshPaymentSessionRequest.java index 5d644d0..851d257 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/RefreshPaymentSessionRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/paymentcollection/RefreshPaymentSessionRequest.java @@ -40,7 +40,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/product/GetProductRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/product/GetProductRequest.java index 459ca33..9204c5b 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/product/GetProductRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/product/GetProductRequest.java @@ -90,7 +90,7 @@ protected Call buildCall() throws ApiException { localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CURRENCY_CODE, currencyCode)); - return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/product/ListProductsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/product/ListProductsRequest.java index c9886ab..0888588 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/product/ListProductsRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/product/ListProductsRequest.java @@ -217,7 +217,7 @@ protected Call buildCall() throws ApiException { localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CURRENCY_CODE, currencyCode)); - return client.buildCall(path, HttpMethod.GET, localVarQueryParams, localVarCollectionQueryParams, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, localVarCollectionQueryParams, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/product/SearchProductsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/product/SearchProductsRequest.java index 329a549..80fd6da 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/product/SearchProductsRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/product/SearchProductsRequest.java @@ -59,7 +59,7 @@ protected Call buildCall() throws ApiException { if (limit != null) localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.LIMIT, limit)); - return client.buildCall(path, HttpMethod.POST, localVarQueryParams, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.POST, localVarQueryParams, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/productcategory/GetProductCategoryRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/productcategory/GetProductCategoryRequest.java index 823b1ae..52ced37 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/productcategory/GetProductCategoryRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/productcategory/GetProductCategoryRequest.java @@ -59,7 +59,7 @@ protected Call buildCall() throws ApiException { String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, localVarAuthNames); + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/productcategory/ListProductCategoriesRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/productcategory/ListProductCategoriesRequest.java index 90f65fe..40b8023 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/productcategory/ListProductCategoriesRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/productcategory/ListProductCategoriesRequest.java @@ -72,8 +72,7 @@ protected Call buildCall() throws ApiException { localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.LIMIT, limit)); - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, localVarAuthNames); + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/producttag/ListProductTagsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/producttag/ListProductTagsRequest.java index 06575be..3158eff 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/producttag/ListProductTagsRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/producttag/ListProductTagsRequest.java @@ -8,10 +8,9 @@ import mobi.appcent.medusa.store.common.UrlConstant; import mobi.appcent.medusa.store.model.request.BaseRequest; import mobi.appcent.medusa.store.model.response.CreatedAt2; -import mobi.appcent.medusa.store.model.response.InlineResponse200; +import mobi.appcent.medusa.store.model.response.ProductTagsResponse; import mobi.appcent.medusa.store.model.response.UpdatedAt2; -import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -20,7 +19,7 @@ /** * Created by erenalpaslan on 10.03.2023 */ -public class ListProductTagsRequest extends BaseRequest { +public class ListProductTagsRequest extends BaseRequest { private final MedusaSdkClient client; private Integer limit; @@ -115,17 +114,17 @@ protected Call buildCall() throws ApiException { localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.UPDATED_AT, updatedAt)); - return client.buildCall(path, HttpMethod.GET, localVarQueryParams, localVarCollectionQueryParams, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, localVarCollectionQueryParams, null, headers, null); } @Override - public ApiResponse execute() throws ApiException { + public ApiResponse execute() throws ApiException { Call call = buildCall(); return client.execute(call); } @Override - public void executeAsync(ApiCallback callback) throws ApiException { + public void executeAsync(ApiCallback callback) throws ApiException { Call call = buildCall(); client.executeAsync(call, callback); } diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/producttype/ListProductTypesRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/producttype/ListProductTypesRequest.java index 9941c29..b2cd7db 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/producttype/ListProductTypesRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/producttype/ListProductTypesRequest.java @@ -114,8 +114,7 @@ protected Call buildCall() throws ApiException { if (updatedAt != null) localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.UPDATED_AT, updatedAt)); - String[] localVarAuthNames = new String[] { "cookie_auth" }; - return client.buildCall(path, HttpMethod.GET, localVarQueryParams, localVarCollectionQueryParams, null, headers, null, localVarAuthNames); + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, localVarCollectionQueryParams, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/productvariant/GetProductVariantRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/productvariant/GetProductVariantRequest.java index e9f65ca..646fbb8 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/productvariant/GetProductVariantRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/productvariant/GetProductVariantRequest.java @@ -74,7 +74,7 @@ protected Call buildCall() throws ApiException { localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.CURRENCY_CODE, currencyCode)); - return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/productvariant/GetProductVariantsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/productvariant/GetProductVariantsRequest.java index b2dd4e5..41173eb 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/productvariant/GetProductVariantsRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/productvariant/GetProductVariantsRequest.java @@ -123,7 +123,7 @@ protected Call buildCall() throws ApiException { localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.INVENTORY_QUANTITY, inventoryQuantity)); - return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/region/GetRegionRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/region/GetRegionRequest.java index aeb2f33..7ceb815 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/region/GetRegionRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/region/GetRegionRequest.java @@ -39,7 +39,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/region/ListRegionsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/region/ListRegionsRequest.java index 7ec024e..886d998 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/region/ListRegionsRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/region/ListRegionsRequest.java @@ -73,7 +73,7 @@ protected Call buildCall() throws ApiException { if (updatedAt != null) localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.UPDATED_AT, updatedAt)); - return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/returnreason/GetReturnReasonRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/returnreason/GetReturnReasonRequest.java index e288033..f61b4c9 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/returnreason/GetReturnReasonRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/returnreason/GetReturnReasonRequest.java @@ -38,7 +38,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/returnreason/ListReturnReasonRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/returnreason/ListReturnReasonRequest.java index 459e5a1..1a5e7b3 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/returnreason/ListReturnReasonRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/returnreason/ListReturnReasonRequest.java @@ -36,7 +36,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/returns/CreateReturnRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/returns/CreateReturnRequest.java index d492937..4955621 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/returns/CreateReturnRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/returns/CreateReturnRequest.java @@ -43,7 +43,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/shippingoption/GetShippingOptionsByCartIdRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/shippingoption/GetShippingOptionsByCartIdRequest.java index 3b790f6..3ed6cf1 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/shippingoption/GetShippingOptionsByCartIdRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/shippingoption/GetShippingOptionsByCartIdRequest.java @@ -34,7 +34,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/shippingoption/GetShippingOptionsRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/shippingoption/GetShippingOptionsRequest.java index 9039bf3..ea98c13 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/shippingoption/GetShippingOptionsRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/shippingoption/GetShippingOptionsRequest.java @@ -64,7 +64,7 @@ protected Call buildCall() throws ApiException { localVarQueryParams.addAll(client.parameterToPair(QueryParamConstant.REGION_ID, regionId)); - return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, localVarQueryParams, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/swap/CreateSwapRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/swap/CreateSwapRequest.java index da37dae..81bb0d9 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/swap/CreateSwapRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/swap/CreateSwapRequest.java @@ -43,7 +43,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null, null); + return client.buildCall(path, HttpMethod.POST, null, null, body, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/request/swap/GetSwapByCartIdRequest.java b/src/main/java/mobi/appcent/medusa/store/model/request/swap/GetSwapByCartIdRequest.java index 4fe672e..09087e1 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/request/swap/GetSwapByCartIdRequest.java +++ b/src/main/java/mobi/appcent/medusa/store/model/request/swap/GetSwapByCartIdRequest.java @@ -36,7 +36,7 @@ protected Call buildCall() throws ApiException { if (localVarAccept != null) headers.put(HeaderConstant.ACCEPT, localVarAccept); headers.put(HeaderConstant.CONTENT_TYPE, HeaderConstant.APPLICATION_JSON); - return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null, null); + return client.buildCall(path, HttpMethod.GET, null, null, null, headers, null); } @Override diff --git a/src/main/java/mobi/appcent/medusa/store/model/response/InlineResponse200.java b/src/main/java/mobi/appcent/medusa/store/model/response/ProductTagsResponse.java similarity index 94% rename from src/main/java/mobi/appcent/medusa/store/model/response/InlineResponse200.java rename to src/main/java/mobi/appcent/medusa/store/model/response/ProductTagsResponse.java index 2b03f6c..89f2279 100644 --- a/src/main/java/mobi/appcent/medusa/store/model/response/InlineResponse200.java +++ b/src/main/java/mobi/appcent/medusa/store/model/response/ProductTagsResponse.java @@ -22,7 +22,7 @@ */ @javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2023-02-24T12:45:51.835798768Z[GMT]") -public class InlineResponse200 { +public class ProductTagsResponse { @SerializedName("product_tags") private ProductTag productTags = null; @@ -35,7 +35,7 @@ public class InlineResponse200 { @SerializedName("limit") private Integer limit = null; - public InlineResponse200 productTags(ProductTag productTags) { + public ProductTagsResponse productTags(ProductTag productTags) { this.productTags = productTags; return this; } @@ -53,7 +53,7 @@ public void setProductTags(ProductTag productTags) { this.productTags = productTags; } - public InlineResponse200 count(Integer count) { + public ProductTagsResponse count(Integer count) { this.count = count; return this; } @@ -71,7 +71,7 @@ public void setCount(Integer count) { this.count = count; } - public InlineResponse200 offset(Integer offset) { + public ProductTagsResponse offset(Integer offset) { this.offset = offset; return this; } @@ -89,7 +89,7 @@ public void setOffset(Integer offset) { this.offset = offset; } - public InlineResponse200 limit(Integer limit) { + public ProductTagsResponse limit(Integer limit) { this.limit = limit; return this; } @@ -116,11 +116,11 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - InlineResponse200 inlineResponse200 = (InlineResponse200) o; - return Objects.equals(this.productTags, inlineResponse200.productTags) && - Objects.equals(this.count, inlineResponse200.count) && - Objects.equals(this.offset, inlineResponse200.offset) && - Objects.equals(this.limit, inlineResponse200.limit); + ProductTagsResponse productTagsResponse = (ProductTagsResponse) o; + return Objects.equals(this.productTags, productTagsResponse.productTags) && + Objects.equals(this.count, productTagsResponse.count) && + Objects.equals(this.offset, productTagsResponse.offset) && + Objects.equals(this.limit, productTagsResponse.limit); } @Override diff --git a/src/test/java/mobi/appcent/medusa/store/api/ProductTagApiTest.java b/src/test/java/mobi/appcent/medusa/store/api/ProductTagApiTest.java index 34004e7..863adda 100644 --- a/src/test/java/mobi/appcent/medusa/store/api/ProductTagApiTest.java +++ b/src/test/java/mobi/appcent/medusa/store/api/ProductTagApiTest.java @@ -13,7 +13,7 @@ package mobi.appcent.medusa.store.api; import mobi.appcent.medusa.store.model.response.CreatedAt2; -import mobi.appcent.medusa.store.model.response.InlineResponse200; +import mobi.appcent.medusa.store.model.response.ProductTagsResponse; import mobi.appcent.medusa.store.model.response.UpdatedAt2; import org.junit.Test; import org.junit.Ignore; @@ -49,7 +49,7 @@ public void getProductTagsTest() throws Exception { String q = null; CreatedAt2 createdAt = null; UpdatedAt2 updatedAt = null; - InlineResponse200 response = api.getProductTags().execute().getData(); + ProductTagsResponse response = api.getProductTags().execute().getData(); // TODO: test validations } From e5f87163b9ccdd6427f498e66b338347a86f4802 Mon Sep 17 00:00:00 2001 From: Eren Date: Thu, 20 Apr 2023 21:42:46 +0300 Subject: [PATCH 27/32] build: Updates version to 1.0.1 --- .idea/jarRepositories.xml | 5 +++++ build.gradle | 2 +- pom.xml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml index 712ab9d..f1dbc6b 100644 --- a/.idea/jarRepositories.xml +++ b/.idea/jarRepositories.xml @@ -1,6 +1,11 @@ + +